diff --git a/lib/net.js b/lib/net.js index d0648e5d0d5b35..0d6a79f2714528 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); }