mirror of https://github.com/grpc/grpc-node.git
Upmerge 1.14 to master
This commit is contained in:
commit
41ac29ddd5
|
|
@ -91,7 +91,7 @@
|
|||
'GPR_BACKWARDS_COMPATIBILITY_MODE',
|
||||
'GRPC_ARES=0',
|
||||
'GRPC_UV',
|
||||
'GRPC_NODE_VERSION="1.15.0-dev"'
|
||||
'GRPC_NODE_VERSION="1.14.1"'
|
||||
],
|
||||
'conditions': [
|
||||
['grpc_gcov=="true"', {
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
settings:
|
||||
'#': It's possible to have node_version here as a key to override the core's version.
|
||||
node_version: 1.14.1
|
||||
|
|
|
|||
|
|
@ -270,6 +270,10 @@ NAN_METHOD(Channel::GetTarget) {
|
|||
"getTarget can only be called on Channel objects");
|
||||
}
|
||||
Channel *channel = ObjectWrap::Unwrap<Channel>(info.This());
|
||||
if (channel->wrapped_channel == NULL) {
|
||||
return Nan::ThrowError(
|
||||
"Cannot call getTarget on a closed Channel");
|
||||
}
|
||||
info.GetReturnValue().Set(
|
||||
Nan::New(grpc_channel_get_target(channel->wrapped_channel))
|
||||
.ToLocalChecked());
|
||||
|
|
@ -281,6 +285,10 @@ NAN_METHOD(Channel::GetConnectivityState) {
|
|||
"getConnectivityState can only be called on Channel objects");
|
||||
}
|
||||
Channel *channel = ObjectWrap::Unwrap<Channel>(info.This());
|
||||
if (channel->wrapped_channel == NULL) {
|
||||
return Nan::ThrowError(
|
||||
"Cannot call getConnectivityState on a closed Channel");
|
||||
}
|
||||
int try_to_connect = (int)info[0]->Equals(Nan::True());
|
||||
info.GetReturnValue().Set(grpc_channel_check_connectivity_state(
|
||||
channel->wrapped_channel, try_to_connect));
|
||||
|
|
@ -303,12 +311,16 @@ NAN_METHOD(Channel::WatchConnectivityState) {
|
|||
return Nan::ThrowTypeError(
|
||||
"watchConnectivityState's third argument must be a callback");
|
||||
}
|
||||
Channel *channel = ObjectWrap::Unwrap<Channel>(info.This());
|
||||
if (channel->wrapped_channel == NULL) {
|
||||
return Nan::ThrowError(
|
||||
"Cannot call watchConnectivityState on a closed Channel");
|
||||
}
|
||||
grpc_connectivity_state last_state = static_cast<grpc_connectivity_state>(
|
||||
Nan::To<uint32_t>(info[0]).FromJust());
|
||||
double deadline = Nan::To<double>(info[1]).FromJust();
|
||||
Local<Function> callback_func = info[2].As<Function>();
|
||||
Nan::Callback *callback = new Callback(callback_func);
|
||||
Channel *channel = ObjectWrap::Unwrap<Channel>(info.This());
|
||||
unique_ptr<OpVec> ops(new OpVec());
|
||||
grpc_channel_watch_connectivity_state(
|
||||
channel->wrapped_channel, last_state, MillisecondsToTimespec(deadline),
|
||||
|
|
|
|||
|
|
@ -816,7 +816,7 @@ declare module "grpc" {
|
|||
* Additional peer verification options that can be set when creating
|
||||
* SSL credentials.
|
||||
*/
|
||||
export interface VerifyOptions: {
|
||||
export interface VerifyOptions {
|
||||
/**
|
||||
* If set, this callback will be invoked after the usual hostname verification
|
||||
* has been performed on the peer certificate.
|
||||
|
|
@ -1538,7 +1538,7 @@ declare module "grpc" {
|
|||
* @param callback Called with no error when a state change, or with an
|
||||
* error if the deadline passes without a state change.
|
||||
*/
|
||||
watchConnectivityState(currentState: connectivityState, deadline: Date|number, callback: (error?: Error) => void);
|
||||
watchConnectivityState(currentState: connectivityState, deadline: Date|number, callback: (error?: Error) => void): void;
|
||||
/**
|
||||
* Create a call object. Call is an opaque type that is used by the Client
|
||||
* and Server classes. This function is called by the gRPC library when
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "grpc",
|
||||
"version": "1.15.0-dev",
|
||||
"version": "1.14.1",
|
||||
"author": "Google Inc.",
|
||||
"description": "gRPC Library for Node",
|
||||
"homepage": "https://grpc.io/",
|
||||
|
|
@ -19,10 +19,10 @@
|
|||
"lib": "src"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "./node_modules/.bin/node-pre-gyp build",
|
||||
"electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell",
|
||||
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test",
|
||||
"install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library",
|
||||
"build": "node-pre-gyp build",
|
||||
"electron-build": "node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell",
|
||||
"coverage": "istanbul cover ./node_modules/.bin/_mocha test",
|
||||
"install": "node-pre-gyp install --fallback-to-build --library=static_library",
|
||||
"prepack": "git submodule update --init --recursive && npm install"
|
||||
},
|
||||
"bundledDependencies": [
|
||||
|
|
@ -67,7 +67,8 @@
|
|||
"ext/*.{cc,h}",
|
||||
"deps/grpc/include/grpc/**/*.h",
|
||||
"deps/grpc/src/core/**/*.{c,cc,h}",
|
||||
"deps/grpc/src/boringssl/*.{c,cc,h}",
|
||||
"deps/grpc/src/boringssl/err_data.c",
|
||||
"deps/grpc/src/cpp/ext/filters/census/grpc_context.cc",
|
||||
"deps/grpc/third_party/nanopb/*.{c,cc,h}",
|
||||
"deps/grpc/third_party/zlib/**/*.{c,cc,h}",
|
||||
"deps/grpc/third_party/boringssl/crypto/**/*.{c,cc,h}",
|
||||
|
|
|
|||
|
|
@ -720,13 +720,23 @@ Client.prototype.waitForReady = function(deadline, callback) {
|
|||
callback(new Error('Failed to connect before the deadline'));
|
||||
return;
|
||||
}
|
||||
var new_state = self.$channel.getConnectivityState(true);
|
||||
var new_state;
|
||||
try {
|
||||
new_state = self.$channel.getConnectivityState(true);
|
||||
} catch (e) {
|
||||
callback(new Error('The channel has been closed'));
|
||||
return;
|
||||
}
|
||||
if (new_state === grpc.connectivityState.READY) {
|
||||
callback();
|
||||
} else if (new_state === grpc.connectivityState.FATAL_FAILURE) {
|
||||
callback(new Error('Failed to connect to server'));
|
||||
} else {
|
||||
self.$channel.watchConnectivityState(new_state, deadline, checkState);
|
||||
try {
|
||||
self.$channel.watchConnectivityState(new_state, deadline, checkState);
|
||||
} catch (e) {
|
||||
callback(new Error('The channel has been closed'));
|
||||
}
|
||||
}
|
||||
};
|
||||
/* Force a single round of polling to ensure that the channel state is up
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@
|
|||
"lib": "src"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "./node_modules/.bin/node-pre-gyp build",
|
||||
"electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell",
|
||||
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test",
|
||||
"install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library",
|
||||
"build": "node-pre-gyp build",
|
||||
"electron-build": "node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell",
|
||||
"coverage": "istanbul cover ./node_modules/.bin/_mocha test",
|
||||
"install": "node-pre-gyp install --fallback-to-build --library=static_library",
|
||||
"prepack": "git submodule update --init --recursive && npm install"
|
||||
},
|
||||
"bundledDependencies": [
|
||||
|
|
@ -69,7 +69,8 @@
|
|||
"ext/*.{cc,h}",
|
||||
"deps/grpc/include/grpc/**/*.h",
|
||||
"deps/grpc/src/core/**/*.{c,cc,h}",
|
||||
"deps/grpc/src/boringssl/*.{c,cc,h}",
|
||||
"deps/grpc/src/boringssl/err_data.c",
|
||||
"deps/grpc/src/cpp/ext/filters/census/grpc_context.cc",
|
||||
"deps/grpc/third_party/nanopb/*.{c,cc,h}",
|
||||
"deps/grpc/third_party/zlib/**/*.{c,cc,h}",
|
||||
"deps/grpc/third_party/boringssl/crypto/**/*.{c,cc,h}",
|
||||
|
|
|
|||
Loading…
Reference in New Issue