Skip to content

Commit

Permalink
net: partially revert "simplify Socket.prototype._final"
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
addaleax authored and BridgeAR committed Nov 13, 2018
1 parent ddbd0e1 commit 7445126
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 7445126

Please sign in to comment.