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
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 @@
// 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();
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 @@
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;
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 @@
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: