Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Revert "net: don't normalize twice in Socket#connect()"
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
commit 44de1fc7de122988d59bc785f01d87f0d766e6ea
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