Skip to content

Commit

Permalink
net: use callback to properly propagate error
Browse files Browse the repository at this point in the history
The socket will be destroyed upstream through the proper error
flow.

PR-URL: #29178
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
ronag authored and Trott committed Aug 20, 2019
1 parent 490ec9b commit cc7cec2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ Socket.prototype._writeGeneric = function(writev, data, encoding, cb) {
this._pendingEncoding = '';

if (!this._handle) {
this.destroy(new ERR_SOCKET_CLOSED(), cb);
cb(new ERR_SOCKET_CLOSED());
return false;
}

Expand Down

0 comments on commit cc7cec2

Please sign in to comment.