Skip to content

Commit

Permalink
Revert "net: don't normalize twice in Socket#connect()"
Browse files Browse the repository at this point in the history
This reverts commit bb06add.
This commit was causing failures in the async-listener module,
which monkey patches Socket.prototype.connect().
  • Loading branch information
cjihrig committed May 5, 2017
1 parent 94a120c commit 44de1fc
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function connect() {
socket.setTimeout(options.timeout);
}

return realConnect.call(socket, options, cb);
return Socket.prototype.connect.call(socket, options, cb);
}


Expand Down Expand Up @@ -919,14 +919,10 @@ Socket.prototype.connect = function() {
for (var i = 0; i < arguments.length; i++)
args[i] = arguments[i];
// TODO(joyeecheung): use destructuring when V8 is fast enough
var normalized = normalizeArgs(args);
var options = normalized[0];
var cb = normalized[1];
return realConnect.call(this, options, cb);
};
const normalized = normalizeArgs(args);
const options = normalized[0];
const cb = normalized[1];


function realConnect(options, cb) {
if (this.write !== Socket.prototype.write)
this.write = Socket.prototype.write;

Expand Down Expand Up @@ -967,7 +963,7 @@ function realConnect(options, cb) {
lookupAndConnect(this, options);
}
return this;
}
};


function lookupAndConnect(self, options) {
Expand Down

0 comments on commit 44de1fc

Please sign in to comment.