mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Bugfix: do not create CAddress for invalid accepts
This commit is contained in:
parent
15b87b2ec4
commit
25ab17585e
@ -740,13 +740,17 @@ void ThreadSocketHandler2(void* parg)
|
|||||||
struct sockaddr_in sockaddr;
|
struct sockaddr_in sockaddr;
|
||||||
socklen_t len = sizeof(sockaddr);
|
socklen_t len = sizeof(sockaddr);
|
||||||
SOCKET hSocket = accept(hListenSocket, (struct sockaddr*)&sockaddr, &len);
|
SOCKET hSocket = accept(hListenSocket, (struct sockaddr*)&sockaddr, &len);
|
||||||
CAddress addr(sockaddr);
|
CAddress addr;
|
||||||
int nInbound = 0;
|
int nInbound = 0;
|
||||||
|
|
||||||
|
if (hSocket != INVALID_SOCKET)
|
||||||
|
addr = CAddress(sockaddr);
|
||||||
|
|
||||||
CRITICAL_BLOCK(cs_vNodes)
|
CRITICAL_BLOCK(cs_vNodes)
|
||||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||||
if (pnode->fInbound)
|
if (pnode->fInbound)
|
||||||
nInbound++;
|
nInbound++;
|
||||||
|
|
||||||
if (hSocket == INVALID_SOCKET)
|
if (hSocket == INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
if (WSAGetLastError() != WSAEWOULDBLOCK)
|
if (WSAGetLastError() != WSAEWOULDBLOCK)
|
||||||
|
Loading…
Reference in New Issue
Block a user