Skip to content

Commit 197f86f

Browse files
magnushiiebrianc
authored andcommitted
Fix ECONNRESET error emitted after failed connect (brianc#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 brianc#746.
1 parent 549404e commit 197f86f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/client.js

+1
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ Client.prototype.connect = function(callback) {
182182
if(!callback) {
183183
return self.emit('error', error);
184184
}
185+
con.end(); // make sure ECONNRESET errors don't cause error events
185186
callback(error);
186187
callback = null;
187188
});

0 commit comments

Comments
 (0)