Skip to content

Commit 897114b

Browse files
addaleaxMylesBorins
authored andcommitted
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 PR-URL: #24288 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]>
1 parent 704b68a commit 897114b

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
@@ -344,6 +344,12 @@ Socket.prototype._final = function(cb) {
344344
return this.once('connect', () => this._final(cb));
345345
}
346346

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

0 commit comments

Comments
 (0)