diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-02-16 03:31:14 -0800 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2012-02-16 03:31:14 -0800 |
commit | 2030fc6bc2df90a30e1949cc6fbcfd75e420f5f9 (patch) | |
tree | d0fbe6b39c0c6614a70c1ef47d7fcf74e90c1164 /src/net.cpp | |
parent | 711d5038f5c987f58862fd78a980d578d4183dbe (diff) | |
parent | 25ab17585efa37739da61c8ffc663b1954a653c4 (diff) | |
download | bitcoin-2030fc6bc2df90a30e1949cc6fbcfd75e420f5f9.tar.xz |
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.cpp | 6 |
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) |