Skip to content

Commit ac1f56c

Browse files
committed
net: partially revert "simplify Socket.prototype._final"
Partially revert b7e6ccd because it broke a test that was added since its last CI run. Refs: #24075 Refs: #23866
1 parent f77bb3c commit ac1f56c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/net.js

+6
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,12 @@ Socket.prototype._final = function(cb) {
345345
return this.once('connect', () => this._final(cb));
346346
}
347347

348+
// TODO(addaleax): This should not be necessary.
349+
if (!this.readable || this._readableState.ended) {
350+
cb();
351+
return this.destroy();
352+
}
353+
348354
if (!this._handle)
349355
return cb();
350356

0 commit comments

Comments
 (0)