mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
net: partially revert "simplify Socket.prototype._final"
Partially revert b7e6ccd0cc
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:
1 file changed
+6
@@ -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();
|
||||
|
||||
|
||||
Reference in new issue
Block a user