mirror of https://github.com/grpc/grpc-node.git
Merge branch 'master' into dependency_cleanup
This commit is contained in:
commit
a101e8b6a5
17
gulpfile.js
17
gulpfile.js
|
@ -1,3 +1,20 @@
|
|||
/*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
const _gulp = require('gulp');
|
||||
const help = require('gulp-help');
|
||||
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
/*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
const xml2js = require('xml2js');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
/*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
const _gulp = require('gulp');
|
||||
const help = require('gulp-help');
|
||||
const mocha = require('gulp-mocha');
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
/*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const _gulp = require('gulp');
|
||||
|
|
|
@ -207,6 +207,9 @@
|
|||
'target_name': 'boringssl',
|
||||
'product_prefix': 'lib',
|
||||
'type': 'static_library',
|
||||
'cflags': [
|
||||
'-Wimplicit-fallthrough=0'
|
||||
],
|
||||
'dependencies': [
|
||||
],
|
||||
'sources': [
|
||||
|
|
|
@ -35,7 +35,7 @@ grpc_completion_queue *queue;
|
|||
uv_prepare_t prepare;
|
||||
int pending_batches;
|
||||
|
||||
void drain_completion_queue(uv_prepare_t *handle) {
|
||||
static void drain_completion_queue(uv_prepare_t *handle) {
|
||||
Nan::HandleScope scope;
|
||||
grpc_event event;
|
||||
(void)handle;
|
||||
|
@ -53,9 +53,9 @@ void drain_completion_queue(uv_prepare_t *handle) {
|
|||
CompleteTag(event.tag, error_message);
|
||||
grpc::node::DestroyTag(event.tag);
|
||||
pending_batches--;
|
||||
if (pending_batches == 0) {
|
||||
uv_prepare_stop(&prepare);
|
||||
}
|
||||
}
|
||||
if (pending_batches == 0) {
|
||||
uv_prepare_stop(&prepare);
|
||||
}
|
||||
} while (event.type != GRPC_QUEUE_TIMEOUT);
|
||||
}
|
||||
|
@ -76,5 +76,15 @@ void CompletionQueueInit(Local<Object> exports) {
|
|||
pending_batches = 0;
|
||||
}
|
||||
|
||||
void CompletionQueueForcePoll() {
|
||||
/* This sets the prepare object to poll on the completion queue the next time
|
||||
* Node polls for IO. But it doesn't increment the number of pending batches,
|
||||
* so it will immediately stop polling after that unless there is an
|
||||
* intervening CompletionQueueNext call */
|
||||
if (pending_batches == 0) {
|
||||
uv_prepare_start(&prepare, drain_completion_queue);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace node
|
||||
} // namespace grpc
|
||||
|
|
|
@ -28,5 +28,7 @@ void CompletionQueueNext();
|
|||
|
||||
void CompletionQueueInit(v8::Local<v8::Object> exports);
|
||||
|
||||
void CompletionQueueForcePoll();
|
||||
|
||||
} // namespace node
|
||||
} // namespace grpc
|
||||
|
|
|
@ -265,6 +265,10 @@ NAN_METHOD(SetLogVerbosity) {
|
|||
gpr_set_log_verbosity(severity);
|
||||
}
|
||||
|
||||
NAN_METHOD(ForcePoll) {
|
||||
grpc::node::CompletionQueueForcePoll();
|
||||
}
|
||||
|
||||
void init(Local<Object> exports) {
|
||||
Nan::HandleScope scope;
|
||||
grpc_init();
|
||||
|
@ -306,6 +310,9 @@ void init(Local<Object> exports) {
|
|||
Nan::Set(exports, Nan::New("setLogVerbosity").ToLocalChecked(),
|
||||
Nan::GetFunction(Nan::New<FunctionTemplate>(SetLogVerbosity))
|
||||
.ToLocalChecked());
|
||||
Nan::Set(exports, Nan::New("forcePoll").ToLocalChecked(),
|
||||
Nan::GetFunction(Nan::New<FunctionTemplate>(ForcePoll))
|
||||
.ToLocalChecked());
|
||||
}
|
||||
|
||||
NODE_MODULE(grpc_node, init)
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
/*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
const _gulp = require('gulp');
|
||||
const help = require('gulp-help');
|
||||
|
||||
|
|
|
@ -800,7 +800,10 @@ Client.prototype.waitForReady = function(deadline, callback) {
|
|||
self.$channel.watchConnectivityState(new_state, deadline, checkState);
|
||||
}
|
||||
};
|
||||
checkState();
|
||||
/* Force a single round of polling to ensure that the channel state is up
|
||||
* to date */
|
||||
grpc.forcePoll();
|
||||
setImmediate(checkState);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -194,6 +194,9 @@
|
|||
'target_name': '${lib.name}',
|
||||
'product_prefix': 'lib',
|
||||
'type': 'static_library',
|
||||
'cflags': [
|
||||
'-Wimplicit-fallthrough=0'
|
||||
],
|
||||
'dependencies': [
|
||||
% for dep in getattr(lib, 'deps', []):
|
||||
'${dep}',
|
||||
|
|
15
setup.sh
15
setup.sh
|
@ -1,3 +1,18 @@
|
|||
#!/bin/sh
|
||||
# Copyright 2017 gRPC authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
if [ -z $NODE_H2 ]; then
|
||||
echo "\$NODE_H2 must point to a node binary"
|
||||
exit 1
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
/*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
const _gulp = require('gulp');
|
||||
const help = require('gulp-help');
|
||||
const mocha = require('gulp-mocha');
|
||||
|
|
Loading…
Reference in New Issue