diff --git a/lib/net.js b/lib/net.js index 00f7ed735a4..e41ef199543 100644 --- a/lib/net.js +++ b/lib/net.js @@ -277,9 +277,8 @@ function writeAfterFIN(chunk, encoding, cb) { var er = new Error('This socket has been ended by the other party'); er.code = 'EPIPE'; - var self = this; // TODO: defer error events consistently everywhere, not just the cb - self.emit('error', er); + this.emit('error', er); if (typeof cb === 'function') { process.nextTick(cb, er); }