Merge pull request #842 from sipa/checkaf

Do not create CAddress for invalid accepts
This commit is contained in:
Pieter Wuille 2012-02-16 03:31:14 -08:00
commit 2030fc6bc2

View file

@ -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)