net: partially revert "simplify Socket.prototype._final"
Partially revert b7e6ccd0cc60f20cc397e6ac0705bb3f38c7d225 because it broke a test that was added since its last CI run. Refs: https://github.com/nodejs/node/pull/24075 Refs: https://github.com/nodejs/node/pull/23866 PR-URL: https://github.com/nodejs/node/pull/24288 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
This commit is contained in:
parent
f77bb3cb00
commit
fb6c6692a8
@ -345,6 +345,12 @@ 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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user