aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-02-15 20:56:29 +0100
committerPieter Wuille <pieter.wuille@gmail.com>2012-02-15 20:56:29 +0100
commit25ab17585efa37739da61c8ffc663b1954a653c4 (patch)
tree40f0142faada28033b49d8b17866813151b056fd /src
parent15b87b2ec40bdcbc7e8173c79b829fc0f550909e (diff)
Bugfix: do not create CAddress for invalid accepts
Diffstat (limited to 'src')
-rw-r--r--src/net.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 63829d0e0a..a66b1a61d8 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -740,13 +740,17 @@ void ThreadSocketHandler2(void* parg)
struct sockaddr_in sockaddr;
socklen_t len = sizeof(sockaddr);
SOCKET hSocket = accept(hListenSocket, (struct sockaddr*)&sockaddr, &len);
- CAddress addr(sockaddr);
+ CAddress addr;
int nInbound = 0;
+ if (hSocket != INVALID_SOCKET)
+ addr = CAddress(sockaddr);
+
CRITICAL_BLOCK(cs_vNodes)
BOOST_FOREACH(CNode* pnode, vNodes)
if (pnode->fInbound)
nInbound++;
+
if (hSocket == INVALID_SOCKET)
{
if (WSAGetLastError() != WSAEWOULDBLOCK)