diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-11-10 20:59:50 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-11-10 21:54:15 +0100 |
commit | fb6c6692a8d2e7e4d86a742216151a6e5e15739b (patch) | |
tree | 952760bcfb34e8da78422a33021a3a3825d578e2 /lib/net.js | |
parent | f77bb3cb0043f1f7908fa668b40052c331e5af50 (diff) | |
download | android-node-v8-fb6c6692a8d2e7e4d86a742216151a6e5e15739b.tar.gz android-node-v8-fb6c6692a8d2e7e4d86a742216151a6e5e15739b.tar.bz2 android-node-v8-fb6c6692a8d2e7e4d86a742216151a6e5e15739b.zip |
net: partially revert "simplify Socket.prototype._final"
Partially revert b7e6ccd0cc60f20cc397e6ac0705bb3f38c7d225
because it broke a test that was added since its last CI run.
Refs: https://github.com/nodejs/node/pull/24075
Refs: https://github.com/nodejs/node/pull/23866
PR-URL: https://github.com/nodejs/node/pull/24288
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Diffstat (limited to 'lib/net.js')
-rw-r--r-- | lib/net.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/net.js b/lib/net.js index 5d332d9e1d..99dc76c8f3 100644 --- a/lib/net.js +++ b/lib/net.js @@ -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(); |