aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-02-16 03:31:14 -0800
committerPieter Wuille <pieter.wuille@gmail.com>2012-02-16 03:31:14 -0800
commit2030fc6bc2df90a30e1949cc6fbcfd75e420f5f9 (patch)
treed0fbe6b39c0c6614a70c1ef47d7fcf74e90c1164 /src/net.cpp
parent711d5038f5c987f58862fd78a980d578d4183dbe (diff)
parent25ab17585efa37739da61c8ffc663b1954a653c4 (diff)
Merge pull request #842 from sipa/checkaf
Do not create CAddress for invalid accepts
Diffstat (limited to 'src/net.cpp')
-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)