mirror of https://github.com/grpc/grpc-node.git
Merge branch 'grpc@1.16.x' of https://github.com/grpc/grpc-node
This commit is contained in:
commit
8f09c2b0d0
|
@ -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.16.0-pre1
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit bc9e9ddf9e04b1a905d51c41b1ffef5b30f2c986
|
||||
Subproject commit 98457b76ff43efa2c3edd203c14cd923734d5279
|
|
@ -52,7 +52,7 @@ function handleError(call, error) {
|
|||
if (error.hasOwnProperty('message')) {
|
||||
status.details = error.message;
|
||||
}
|
||||
if (error.hasOwnProperty('code')) {
|
||||
if (error.hasOwnProperty('code') && Number.isInteger(error.code)) {
|
||||
status.code = error.code;
|
||||
if (error.hasOwnProperty('details')) {
|
||||
status.details = error.details;
|
||||
|
@ -954,6 +954,7 @@ Server.prototype.addProtoService = util.deprecate(function(service,
|
|||
* "address:port"
|
||||
* @param {grpc.ServerCredentials} creds Server credential object to be used for
|
||||
* SSL. Pass an insecure credentials object for an insecure port.
|
||||
* @return {number} The bound port number. Negative if binding the port failed.
|
||||
*/
|
||||
Server.prototype.bind = function(port, creds) {
|
||||
if (this.started) {
|
||||
|
@ -962,4 +963,32 @@ Server.prototype.bind = function(port, creds) {
|
|||
return this._server.addHttp2Port(port, creds);
|
||||
};
|
||||
|
||||
/**
|
||||
* Called with the result of attempting to bind a port
|
||||
* @callback grpc.Server~bindCallback
|
||||
* @param {Error=} error If non-null, indicates that binding the port failed.
|
||||
* @param {number} port The bound port number. If binding the port fails, this
|
||||
* will be negative to match the output of bind.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Binds the server to the given port, with SSL disabled if creds is an
|
||||
* insecure credentials object. Provides the result asynchronously.
|
||||
* @param {string} port The port that the server should bind on, in the format
|
||||
* "address:port"
|
||||
* @param {grpc.ServerCredentials} creds Server credential object to be used for
|
||||
* SSL. Pass an insecure credentials object for an insecure port.
|
||||
*/
|
||||
Server.prototype.bindAsync = function(port, creds, callback) {
|
||||
/* This can throw. We do not try to catch that error because it indicates an
|
||||
* incorrect use of the function, which should not be surfaced asynchronously
|
||||
*/
|
||||
const result = this.bind(port, creds)
|
||||
if (result < 0) {
|
||||
setImmediate(callback, new Error('Failed to bind port'), result);
|
||||
} else {
|
||||
setImmediate(callback, null, result);
|
||||
}
|
||||
}
|
||||
|
||||
exports.Server = Server;
|
||||
|
|
|
@ -37,14 +37,16 @@ var getServer = require('./math/math_server.js');
|
|||
|
||||
var server = getServer();
|
||||
|
||||
let serverCreds = grpc.ServerCredentials.createInsecure();
|
||||
|
||||
describe('Async functionality', function() {
|
||||
before(function(done) {
|
||||
var port_num = server.bind('0.0.0.0:0',
|
||||
grpc.ServerCredentials.createInsecure());
|
||||
server.start();
|
||||
math_client = new math.Math('localhost:' + port_num,
|
||||
grpc.credentials.createInsecure());
|
||||
done();
|
||||
server.bindAsync('0.0.0.0:0', serverCreds, (error, port_num) => {
|
||||
server.start();
|
||||
math_client = new math.Math('localhost:' + port_num,
|
||||
grpc.credentials.createInsecure());
|
||||
done();
|
||||
});
|
||||
});
|
||||
after(function() {
|
||||
grpc.closeClient(math_client);
|
||||
|
|
|
@ -16,7 +16,7 @@ set arch_list=ia32 x64
|
|||
|
||||
set node_versions=4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 9.0.0 10.0.0
|
||||
|
||||
set electron_versions=1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 2.0.0
|
||||
set electron_versions=1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 2.0.0 3.0.0
|
||||
|
||||
set PATH=%PATH%;C:\Program Files\nodejs\;%APPDATA%\npm
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ set -ex
|
|||
|
||||
arch_list=( ia32 x64 )
|
||||
node_versions=( 4.0.0 5.0.0 6.0.0 7.0.0 8.0.0 9.0.0 10.0.0 )
|
||||
electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 2.0.0 )
|
||||
electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 2.0.0 3.0.0 )
|
||||
|
||||
while true ; do
|
||||
case $1 in
|
||||
|
|
Loading…
Reference in New Issue