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.
This commit is contained in:
Randy Abernethy 2015-02-04 13:18:53 -08:00
parent 281bdae6b2
commit a7270074d3
3 changed files with 8 additions and 12 deletions

View File

@ -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.

View File

@ -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 */

View File

@ -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,