Skip to content

Commit d20791b

Browse files
committed
Prevent socket leak in ThreadSocketHandler.
When we are over our outbound limit ThreadSocketHandler would try to keep the connection if the peer was addnoded. This didn't actually work for two reasons: It didn't actually run the accept code due to mistaken code flow, and because we have a limited number of outbound semaphores it couldn't actually use the connection. Instead it leaked the socket, which might have caused issue #4034. This patch just takes out the non-functioning white-listing for now.
1 parent 20ecf5c commit d20791b

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/net.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -946,11 +946,7 @@ void ThreadSocketHandler()
946946
}
947947
else if (nInbound >= nMaxConnections - MAX_OUTBOUND_CONNECTIONS)
948948
{
949-
{
950-
LOCK(cs_setservAddNodeAddresses);
951-
if (!setservAddNodeAddresses.count(addr))
952-
closesocket(hSocket);
953-
}
949+
closesocket(hSocket);
954950
}
955951
else if (CNode::IsBanned(addr))
956952
{

0 commit comments

Comments
 (0)