You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ra...@apache.org on 2016/04/11 23:39:14 UTC
thrift git commit: THRIFT-3786: Node TLS emits 'connect' before
connection is ready Client: Node Patch: James Reggio
Repository: thrift
Updated Branches:
refs/heads/master 3aa461b97 -> 0ea6c1d5d
THRIFT-3786: Node TLS emits 'connect' before connection is ready
Client: Node
Patch: James Reggio
This closes #985
commit b76bad70826d539ddfb26b5277ff3bc09ffa9803
Author: James Reggio <ja...@gmail.com>
Date: 2016-04-11T17:53:12Z
THRIFT-3786 Fix premature firing of `connect` event for secure sockets
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/0ea6c1d5
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/0ea6c1d5
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/0ea6c1d5
Branch: refs/heads/master
Commit: 0ea6c1d5d77f046f089f200c67cffb629f3fe11e
Parents: 3aa461b
Author: Randy Abernethy <ra...@apache.org>
Authored: Mon Apr 11 14:31:19 2016 -0700
Committer: Randy Abernethy <ra...@apache.org>
Committed: Mon Apr 11 14:31:19 2016 -0700
----------------------------------------------------------------------
lib/nodejs/lib/thrift/connection.js | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ea6c1d5/lib/nodejs/lib/thrift/connection.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/lib/thrift/connection.js b/lib/nodejs/lib/thrift/connection.js
index 4b84b76..f9c9bcc 100644
--- a/lib/nodejs/lib/thrift/connection.js
+++ b/lib/nodejs/lib/thrift/connection.js
@@ -36,6 +36,7 @@ var Connection = exports.Connection = function(stream, options) {
this.seqId2Service = {};
this.connection = stream;
+ this.ssl = (stream.encrypted);
this.options = options || {};
this.transport = this.options.transport || TBufferedTransport;
this.protocol = this.options.protocol || TBinaryProtocol;
@@ -61,24 +62,8 @@ var Connection = exports.Connection = function(stream, options) {
this.options.connect_timeout > 0) {
this.connect_timeout = +this.options.connect_timeout;
}
- this.connection.addListener("connect", function() {
- self.connected = true;
-
- this.setTimeout(self.options.timeout || 0);
- this.setNoDelay();
- this.frameLeft = 0;
- this.framePos = 0;
- this.frame = null;
- self.initialize_retry_vars();
- self.offline_queue.forEach(function(data) {
- self.connection.write(data);
- });
-
- self.emit("connect");
- });
-
- this.connection.addListener("secureConnect", function() {
+ this.connection.addListener(this.ssl ? "secureConnect" : "connect", function() {
self.connected = true;
this.setTimeout(self.options.timeout || 0);
@@ -95,7 +80,6 @@ var Connection = exports.Connection = function(stream, options) {
self.emit("connect");
});
-
this.connection.addListener("error", function(err) {
// Only emit the error if no-one else is listening on the connection
// or if someone is listening on us