@@ -401,8 +401,7 @@ function writeAfterFIN(chunk, encoding, cb) { |
|
|
401 |
401 |
// eslint-disable-next-line no-restricted-syntax |
402 |
402 |
var er = new Error('This socket has been ended by the other party'); |
403 |
403 |
er.code = 'EPIPE'; |
404 |
|
-// TODO: defer error events consistently everywhere, not just the cb |
405 |
|
-this.emit('error', er); |
|
404 |
+process.nextTick(emitErrorNT, this, er); |
406 |
405 |
if (typeof cb === 'function') { |
407 |
406 |
defaultTriggerAsyncIdScope(this[async_id_symbol], process.nextTick, cb, er); |
408 |
407 |
} |