mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
net: wrap connect in nextTick
Fixes an edge case regression introduced in
1bef717476.
With the lookup being skipped, an error could be emitted before an
error listener has been added.
An example of this was presented by changing the server’s IP address
and then immediately making a request to the old address.
Related: https://github.com/nodejs/io.js/pull/1823
PR-URL: https://github.com/nodejs/io.js/pull/2054
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
@@ -925,7 +925,9 @@ function lookupAndConnect(self, options) {
|
||||
// TODO(evanlucas) should we hot path this for localhost?
|
||||
var addressType = exports.isIP(host);
|
||||
if (addressType) {
|
||||
connect(self, host, port, addressType, localAddress, localPort);
|
||||
process.nextTick(function() {
|
||||
connect(self, host, port, addressType, localAddress, localPort);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user