From 0d4f043f0ede8b476293ba2c0c86e369331b95ec Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Thu, 20 Jan 2022 16:34:52 +0800 Subject: [PATCH] dgram: remove unreachable connectState assign PR-URL: https://github.com/nodejs/node/pull/38590 Reviewed-By: Ouyang Yadong Reviewed-By: Matteo Collina --- lib/dgram.js | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/lib/dgram.js b/lib/dgram.js index eb26173c6aca4f..221afcf5bb0c84 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -186,9 +186,6 @@ function replaceHandle(self, newHandle) { // Replace the existing handle by the handle we got from primary. oldHandle.close(); state.handle = newHandle; - // Check if the udp handle was connected and set the state accordingly - if (isConnected(self)) - state.connectState = CONNECT_STATE_CONNECTED; } function bufferSize(self, size, buffer) { @@ -292,10 +289,6 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) { if (err) throw errnoException(err, 'open'); - // Check if the udp handle was connected and set the state accordingly - if (isConnected(this)) - state.connectState = CONNECT_STATE_CONNECTED; - startListening(this); return this; } @@ -553,16 +546,6 @@ function clearQueue() { queueEntry(); } -function isConnected(self) { - try { - self.remoteAddress(); - return true; - } catch { - return false; - } -} - - // valid combinations // For connectionless sockets // send(buffer, offset, length, port, address, callback)