Skip to content

Commit 0108d92

Browse files
addaleaxkiyomizumia
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: nodejs#24075 Refs: nodejs#23866 PR-URL: nodejs#24288 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]>
1 parent 4710a5a commit 0108d92

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)