Fix ECONNRESET error emitted after failed connect (#1230)
On Windows, after a connect attempt has failed, an error event with ECONNRESET is emitted after the real connect error is propagated to the connect callback, because the connection is not in ending state (connection._ending) where ECONNRESET is ignored. This change ends the connection when connect has failed. This fixes #746.
This commit is contained in:
parent
549404e21e
commit
197f86f90d
@ -182,6 +182,7 @@ Client.prototype.connect = function(callback) {
|
|||||||
if(!callback) {
|
if(!callback) {
|
||||||
return self.emit('error', error);
|
return self.emit('error', error);
|
||||||
}
|
}
|
||||||
|
con.end(); // make sure ECONNRESET errors don't cause error events
|
||||||
callback(error);
|
callback(error);
|
||||||
callback = null;
|
callback = null;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user