Repository: thrift
Updated Branches:
  refs/heads/master 281bdae6b -> a7270074d


THRIFT-2932: Node.js Thrift connection libraries throw Exceptions into event 
emitter
Client: Nodejs
Patch: Tom Croucher and Andrew de Andrade

This commits a limited set of hunks from teh original patch.


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/a7270074
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/a7270074
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/a7270074

Branch: refs/heads/master
Commit: a7270074d31a25cd5e3965db7013446ac5d21c52
Parents: 281bdae
Author: Randy Abernethy <[email protected]>
Authored: Wed Feb 4 13:18:53 2015 -0800
Committer: Randy Abernethy <[email protected]>
Committed: Wed Feb 4 13:18:53 2015 -0800

----------------------------------------------------------------------
 lib/nodejs/README.md                     |  8 ++------
 lib/nodejs/lib/thrift/http_connection.js | 10 ++++++----
 lib/nodejs/test/thrift_test_driver.js    |  2 --
 3 files changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/a7270074/lib/nodejs/README.md
----------------------------------------------------------------------
diff --git a/lib/nodejs/README.md b/lib/nodejs/README.md
index 22c7caa..88499f7 100644
--- a/lib/nodejs/README.md
+++ b/lib/nodejs/README.md
@@ -60,10 +60,6 @@ Here is a Cassandra example:
 
 Since JavaScript represents all numbers as doubles, int64 values cannot be 
accurately represented naturally. To solve this, int64 values in responses will 
be wrapped with Thirft.Int64 objects. The Int64 implementation used is 
[broofa/node-int64](https://github.com/broofa/node-int64).
 
-## Libraries using node-thrift
+## Client and server examples
 
-* [yukim/node_cassandra](https://github.com/yukim/node_cassandra)
-
-## Custom client and server example
-
-An example based on the one shown on the Thrift front page is included in the 
examples/ folder.
+Several example clients and servers are included in the 
thrift/lib/nodejs/examples folder and the cross language tutorial 
thrift/tutorial/nodejs folder.

http://git-wip-us.apache.org/repos/asf/thrift/blob/a7270074/lib/nodejs/lib/thrift/http_connection.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/lib/thrift/http_connection.js 
b/lib/nodejs/lib/thrift/http_connection.js
index ced1352..b7659bc 100644
--- a/lib/nodejs/lib/thrift/http_connection.js
+++ b/lib/nodejs/lib/thrift/http_connection.js
@@ -19,7 +19,7 @@
 var util = require('util');
 var http = require('http');
 var https = require('https');
-var EventEmitter = require("events").EventEmitter;
+var EventEmitter = require('events').EventEmitter;
 var thrift = require('./thrift');
 var ttransport = require('./transport');
 var tprotocol = require('./protocol');
@@ -93,8 +93,8 @@ var HttpConnection = exports.HttpConnection = function(host, 
port, options) {
     this.nodeOptions[attrname] = this.options.nodeOptions[attrname]; 
   }
   /*jshint -W069 */
-  if (! this.nodeOptions.headers["Connection"]) {
-    this.nodeOptions.headers["Connection"] = "keep-alive";
+  if (! this.nodeOptions.headers['Connection']) {
+    this.nodeOptions.headers['Connection'] = 'keep-alive';
   }
   /*jshint +W069 */
 
@@ -132,7 +132,9 @@ var HttpConnection = exports.HttpConnection = 
function(host, port, options) {
           var clientCallback = client._reqs[header.rseqid];
           delete client._reqs[header.rseqid];
           if (clientCallback) {
-            clientCallback(err, success);
+            process.nextTick(function() {
+              clientCallback(err, success);
+            });
           }
         };
         /*jshint +W083 */

http://git-wip-us.apache.org/repos/asf/thrift/blob/a7270074/lib/nodejs/test/thrift_test_driver.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/thrift_test_driver.js 
b/lib/nodejs/test/thrift_test_driver.js
index b7312fa..5ddcb21 100644
--- a/lib/nodejs/test/thrift_test_driver.js
+++ b/lib/nodejs/test/thrift_test_driver.js
@@ -171,8 +171,6 @@ client.testDouble(7.012052175215044, function(err, 
response) {
   assert.equal(7.012052175215044, response);
 });
 
-// TODO: add testBinary() 
-
 var out = new ttypes.Xtruct({
   string_thing: 'Zero',
   byte_thing: 1,

Reply via email to