From 08b663293cc4f318337a0963f0f97127c8f04e48 Mon Sep 17 00:00:00 2001 From: Ouyang Yadong Date: Thu, 7 Jul 2022 15:45:47 +0800 Subject: [PATCH] net: remove redundant connecting assignment --- 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 c7f932c736584c..33de735a223bc8 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1238,7 +1238,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'); }));