From bf4ac4c55f8cff4cff9e19e323fd48e2db59cff1 Mon Sep 17 00:00:00 2001 From: Ouyang Yadong Date: Sun, 10 Jul 2022 00:10:16 +0800 Subject: [PATCH] net: remove redundant connecting assignment PR-URL: https://github.com/nodejs/node/pull/43710 Reviewed-By: Antoine du Hamel Reviewed-By: Matteo Collina Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Luigi Pinca Reviewed-By: Paolo Insogna --- lib/net.js | 1 - test/sequential/test-net-connect-handle-econnrefused.js | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net.js b/lib/net.js index 745b69085432f2..0868f5363541bf 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1239,7 +1239,6 @@ function afterConnect(status, handle, req, readable, writable) { stopPerf(self, kPerfHooksNetConnectContext); } } else { - self.connecting = false; let details; if (req.localAddress && req.localPort) { details = req.localAddress + ':' + req.localPort; diff --git a/test/sequential/test-net-connect-handle-econnrefused.js b/test/sequential/test-net-connect-handle-econnrefused.js index 3cb7d014b436a4..4bd1b9d2a97e34 100644 --- a/test/sequential/test-net-connect-handle-econnrefused.js +++ b/test/sequential/test-net-connect-handle-econnrefused.js @@ -27,5 +27,6 @@ const assert = require('assert'); const c = net.createConnection(common.PORT); c.on('connect', common.mustNotCall()); c.on('error', common.mustCall((e) => { + assert.strictEqual(c.connecting, false); assert.strictEqual(e.code, 'ECONNREFUSED'); }));