Skip to content

Commit

Permalink
dgram: remove unreachable connectState assign
Browse files Browse the repository at this point in the history
PR-URL: nodejs#38590
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
pd4d10 authored and Linkgoron committed Jan 31, 2022
1 parent 1f7e8f7 commit 6fcb414
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions lib/dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6fcb414

Please sign in to comment.