Updated Branches: refs/heads/master 7a0948399 -> aff2f78b2
THRIFT-2167 nodejs lib throws error if options argument isn't passed Client: nodejs Patch: Randy Abernethy and Red Daly also add examples to test makefile Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/aff2f78b Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/aff2f78b Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/aff2f78b Branch: refs/heads/master Commit: aff2f78b27566145c6bbcb827d4ae472f3ee215b Parents: 7a09483 Author: henrique <[email protected]> Authored: Mon Sep 9 12:38:25 2013 +0200 Committer: henrique <[email protected]> Committed: Mon Sep 9 12:38:25 2013 +0200 ---------------------------------------------------------------------- compiler/cpp/src/generate/t_js_generator.cc | 2 +- lib/nodejs/lib/thrift/connection.js | 20 ++++++++++---------- test/nodejs/Makefile.am | 8 +++++--- 3 files changed, 16 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/aff2f78b/compiler/cpp/src/generate/t_js_generator.cc ---------------------------------------------------------------------- diff --git a/compiler/cpp/src/generate/t_js_generator.cc b/compiler/cpp/src/generate/t_js_generator.cc index 565bb80..7c42c01 100644 --- a/compiler/cpp/src/generate/t_js_generator.cc +++ b/compiler/cpp/src/generate/t_js_generator.cc @@ -1010,7 +1010,7 @@ void t_js_generator::generate_service_client(t_service* tservice) { // utils for multiplexed services if (gen_node_) { indent(f_service_) << js_namespace(tservice->get_program())<<service_name_ << "Client.prototype.seqid = function() { return this._seqid; }" << endl << - js_namespace(tservice->get_program())<<service_name_ << "Client.prototype.new_seqid = function() { this._seqid += 1; }" << endl; + js_namespace(tservice->get_program())<<service_name_ << "Client.prototype.new_seqid = function() { return this._seqid += 1; }" << endl; } // Generate client method implementations vector<t_function*> functions = tservice->get_functions(); http://git-wip-us.apache.org/repos/asf/thrift/blob/aff2f78b/lib/nodejs/lib/thrift/connection.js ---------------------------------------------------------------------- diff --git a/lib/nodejs/lib/thrift/connection.js b/lib/nodejs/lib/thrift/connection.js index 4581d81..8303b08 100644 --- a/lib/nodejs/lib/thrift/connection.js +++ b/lib/nodejs/lib/thrift/connection.js @@ -35,20 +35,20 @@ var Connection = exports.Connection = function(stream, options) { this.offline_queue = []; this.connected = false; - this._debug = options.debug || false; - if (options.max_attempts - && !isNaN(options.max_attempts) && options.max_attempts > 0) { - this.max_attempts = +options.max_attempts; + this._debug = this.options.debug || false; + if (this.options.max_attempts + && !isNaN(this.options.max_attempts) && this.options.max_attempts > 0) { + this.max_attempts = +this.options.max_attempts; } this.retry_max_delay = null; - if (options.retry_max_delay !== undefined - && !isNaN(options.retry_max_delay) && options.retry_max_delay > 0) { - this.retry_max_delay = options.retry_max_delay; + if (this.options.retry_max_delay !== undefined + && !isNaN(this.options.retry_max_delay) && this.options.retry_max_delay > 0) { + this.retry_max_delay = this.options.retry_max_delay; } this.connect_timeout = false; - if (options.connect_timeout - && !isNaN(options.connect_timeout) && options.connect_timeout > 0) { - this.connect_timeout = +options.connect_timeout; + if (this.options.connect_timeout + && !isNaN(this.options.connect_timeout) && this.options.connect_timeout > 0) { + this.connect_timeout = +this.options.connect_timeout; } this.connection.addListener("connect", function() { self.connected = true; http://git-wip-us.apache.org/repos/asf/thrift/blob/aff2f78b/test/nodejs/Makefile.am ---------------------------------------------------------------------- diff --git a/test/nodejs/Makefile.am b/test/nodejs/Makefile.am index ab9a554..a8c10aa 100755 --- a/test/nodejs/Makefile.am +++ b/test/nodejs/Makefile.am @@ -30,12 +30,14 @@ check: stubs echo " Testing Client/Server"; \ timeout -s14 5 $(MAKE) server & \ sleep 1; $(MAKE) client; sleep 2; \ - fi - - @if which node &> /dev/null ; then \ + \ echo " Testing Multiplex Client/Server"; \ sleep 4; timeout -s14 5 $(MAKE) mserver & \ sleep 1; $(MAKE) mclient; sleep 2; \ + \ + echo " Testing Client/Server examples"; \ + sleep 4; timeout -s14 5 $(MAKE) -C ../../lib/nodejs/examples server & \ + sleep 1; $(MAKE) -C ../../lib/nodejs/examples client; sleep 2; \ fi clean-local:
