Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
style fixes
  • Loading branch information
chrisdickinson committed Feb 4, 2015
commit f05d1ebe3ac4d5080fe20a05257d4d94234b00f9
7 changes: 4 additions & 3 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,10 @@ Socket.prototype._destroy = function(exception, cb) {

function fireErrorCallbacks() {
var hadSeenError = self._errorEmitted;
self._errorEmitted = self._errorEmitted || Boolean(exception);
if (cb) cb(exception);
else if (exception && !hadSeenError) {
self._errorEmitted = self._errorEmitted || !!(exception);
if (cb) {
cb(exception);
} else if (exception && !hadSeenError) {
process.nextTick(function() {
self.emit('error', exception);
});
Expand Down