Revert "net: partially revert "simplify Socket.prototype._final""

This reverts commit ac1f56c76a5d1a8ebcb2421d5c629e51df1ac48c.

Refs: https://github.com/nodejs/node/pull/24288
Refs: https://github.com/nodejs/node/pull/24075

PR-URL: https://github.com/nodejs/node/pull/24290
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com>
This commit is contained in:
Anna Henningsen 2018-11-10 21:03:46 +01:00
parent b92d55f718
commit 8cdb92f11c
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9

View File

@ -350,12 +350,6 @@ Socket.prototype._final = function(cb) {
return this.once('connect', () => this._final(cb));
}
// TODO(addaleax): This should not be necessary.
if (!this.readable || this._readableState.ended) {
cb();
return this.destroy();
}
if (!this._handle)
return cb();