From b9ad84bb6cce75bf5d7bf8bef47eb7dc7bc5b6cd Mon Sep 17 00:00:00 2001 From: Gregory Maxwell Date: Wed, 9 Apr 2014 09:25:52 -0700 Subject: [PATCH] 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. --- src/net.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index e62de1044..f53fb2271 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -944,11 +944,7 @@ void ThreadSocketHandler() } else if (nInbound >= nMaxConnections - MAX_OUTBOUND_CONNECTIONS) { - { - LOCK(cs_setservAddNodeAddresses); - if (!setservAddNodeAddresses.count(addr)) - closesocket(hSocket); - } + closesocket(hSocket); } else if (CNode::IsBanned(addr)) {