THRIFT-3789: Add destroy connection feature to node
Client: Nodejs
Patch: James Reggio
Github Pull Request:
This closes #989
commit b2907fd207736ec95f37919528f6dc6990f007c8
Author: James Reggio <james.reggio@gmail.com>
Date: 2016-04-18T19:49:50Z
THRIFT-3789 Add `destroy` to Connection instance
This commit proxies the `destroy` method from the Thrift Connection
object to its underlying socket, akin to the existing `end` method.
Without `destroy`, it's possible for a failed TLS socket to hold the
Node.js process open. (Calling `end` is not sufficient to close the OS
handle because `end` sends a FIN packet, which is never acknowledged by
the server.)
diff --git a/lib/nodejs/lib/thrift/connection.js b/lib/nodejs/lib/thrift/connection.js
index f9c9bcc..0ea50d3 100644
--- a/lib/nodejs/lib/thrift/connection.js
+++ b/lib/nodejs/lib/thrift/connection.js
@@ -163,6 +163,10 @@
this.connection.end();
};
+Connection.prototype.destroy = function() {
+ this.connection.destroy();
+};
+
Connection.prototype.initialize_retry_vars = function () {
this.retry_timer = null;
this.retry_totaltime = 0;