net: destroy socket on DNS error

The socket was never destroyed on DNS errors. This broke some clients, including
lib/https.js.
v0.7.4-release
Stefan Rusu 2012-02-03 18:27:53 +02:00 committed by Ben Noordhuis
parent 68db20656e
commit 4671e54495
1 changed files with 1 additions and 0 deletions

View File

@ -570,6 +570,7 @@ Socket.prototype.connect = function(port /* [host], [cb] */) {
// error event to the next tick. // error event to the next tick.
process.nextTick(function() { process.nextTick(function() {
self.emit('error', err); self.emit('error', err);
self.destroy();
}); });
} else { } else {
timers.active(self); timers.active(self);