From cc7cec25c5fc2fdb8e055e25162c4b231f19e287 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Sat, 17 Aug 2019 13:08:09 +0200 Subject: [PATCH] net: use callback to properly propagate error The socket will be destroyed upstream through the proper error flow. PR-URL: https://github.com/nodejs/node/pull/29178 Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- lib/net.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net.js b/lib/net.js index 09e34f75bd01f2..2b099d75efb7eb 100644 --- a/lib/net.js +++ b/lib/net.js @@ -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; }