Skip to content

Commit 7445126

Browse files
addaleaxBridgeAR
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 <cjihrig@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
1 parent ddbd0e1 commit 7445126

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)