summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2015-03-22 14:28:27 -0700
committerTimothy J Fontaine <tjfontaine@gmail.com>2015-03-24 14:09:16 -0700
commit13f2e7c1177992566b1ec9d0313813da80953ce9 (patch)
tree42ec7595e83f9d2e0b6b092944e102469a7c0c81
parentf201331754d2620cf1770acc8b327d7d9a157333 (diff)
downloadnode-13f2e7c1177992566b1ec9d0313813da80953ce9.tar.gz
net: reinitialize duplex on reconnect
-rw-r--r--lib/net.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/net.js b/lib/net.js
index 3067dc108..48be0acd7 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -148,6 +148,7 @@ function Socket(options) {
else if (util.isUndefined(options))
options = {};
+ this._originalOptions = options;
stream.Duplex.call(this, options);
if (options.handle) {
@@ -891,13 +892,7 @@ Socket.prototype.connect = function(options, cb) {
// XXX this logic is suspect
if (this.destroyed) {
- this._readableState.reading = false;
- this._readableState.ended = false;
- this._readableState.endEmitted = false;
- this._writableState.ended = false;
- this._writableState.ending = false;
- this._writableState.finished = false;
- this._writableState.errorEmitted = false;
+ stream.Duplex.call(this, this._originalOptions);
this.destroyed = false;
this._handle = null;
this._strictEvents = {};