diff options
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(); |