Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis
Created February 10, 2012 20:22
Show Gist options
  • Save bnoordhuis/1792505 to your computer and use it in GitHub Desktop.
Save bnoordhuis/1792505 to your computer and use it in GitHub Desktop.
diff --git a/lib/net.js b/lib/net.js
index f98bcfc..64c4dfd 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -569,8 +569,7 @@ Socket.prototype.connect = function(port /* [host], [cb] */) {
// There are no event listeners registered yet so defer the
// error event to the next tick.
process.nextTick(function() {
- self.emit('error', err);
- self.destroy();
+ self.destroy(err);
});
} else {
timers.active(self);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment