aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node/interop
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nnoble@google.com>2015-01-26 11:41:12 -0800
committerGravatar Nicolas Noble <nnoble@google.com>2015-01-26 11:41:12 -0800
commitfee065c1c7f01207c0e484c92681cea184b1983a (patch)
tree11baf429fdee72a169bdb0b1d17f16154ab5186a /src/node/interop
parent614c2bf99b1865761e5a05a56faf1ad8f26138ff (diff)
parentc41704bada0dc8974e7063f84dae934931813811 (diff)
Merge branch 'master' of github.com:google/grpc into json
Conflicts: src/core/security/credentials.c
Diffstat (limited to 'src/node/interop')
-rw-r--r--src/node/interop/interop_client.js2
-rw-r--r--src/node/interop/interop_server.js12
2 files changed, 8 insertions, 6 deletions
diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js
index cf75b9a77a..9306317b68 100644
--- a/src/node/interop/interop_client.js
+++ b/src/node/interop/interop_client.js
@@ -183,7 +183,7 @@ function pingPong(client, done) {
assert.equal(response.payload.body.limit - response.payload.body.offset,
response_sizes[index]);
index += 1;
- if (index == 4) {
+ if (index === 4) {
call.end();
} else {
call.write({
diff --git a/src/node/interop/interop_server.js b/src/node/interop/interop_server.js
index 735b7a6d18..ebf847876c 100644
--- a/src/node/interop/interop_server.js
+++ b/src/node/interop/interop_server.js
@@ -157,7 +157,8 @@ function handleHalfDuplex(call) {
* Get a server object bound to the given port
* @param {string} port Port to which to bind
* @param {boolean} tls Indicates that the bound port should use TLS
- * @return {Server} Server object bound to the support
+ * @return {{server: Server, port: number}} Server object bound to the support,
+ * and port number that the server is bound to
*/
function getServer(port, tls) {
// TODO(mlumish): enable TLS functionality
@@ -183,8 +184,8 @@ function getServer(port, tls) {
halfDuplexCall: handleHalfDuplex
}
}, options);
- server.bind('0.0.0.0:' + port, tls);
- return server;
+ var port_num = server.bind('0.0.0.0:' + port, tls);
+ return {server: server, port: port_num};
}
if (require.main === module) {
@@ -192,8 +193,9 @@ if (require.main === module) {
var argv = parseArgs(process.argv, {
string: ['port', 'use_tls']
});
- var server = getServer(argv.port, argv.use_tls === 'true');
- server.start();
+ var server_obj = getServer(argv.port, argv.use_tls === 'true');
+ console.log('Server attaching to port ' + argv.port);
+ server_obj.server.listen();
}
/**