mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Refactor: Move failure conditions to the top of AcceptConnection
This commit is contained in:
parent
1ef4817614
commit
ae037b707c
14
src/net.cpp
14
src/net.cpp
@ -811,6 +811,13 @@ static void AcceptConnection(const ListenSocket& hListenSocket) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CNode::IsBanned(addr) && !whitelisted)
|
||||||
|
{
|
||||||
|
LogPrintf("connection from %s dropped (banned)\n", addr.ToString());
|
||||||
|
CloseSocket(hSocket);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (nInbound >= nMaxInbound)
|
if (nInbound >= nMaxInbound)
|
||||||
{
|
{
|
||||||
LogPrint("net", "connection from %s dropped (full)\n", addr.ToString());
|
LogPrint("net", "connection from %s dropped (full)\n", addr.ToString());
|
||||||
@ -825,13 +832,6 @@ static void AcceptConnection(const ListenSocket& hListenSocket) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CNode::IsBanned(addr) && !whitelisted)
|
|
||||||
{
|
|
||||||
LogPrintf("connection from %s dropped (banned)\n", addr.ToString());
|
|
||||||
CloseSocket(hSocket);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CNode* pnode = new CNode(hSocket, addr, "", true);
|
CNode* pnode = new CNode(hSocket, addr, "", true);
|
||||||
pnode->AddRef();
|
pnode->AddRef();
|
||||||
pnode->fWhitelisted = whitelisted;
|
pnode->fWhitelisted = whitelisted;
|
||||||
|
Loading…
Reference in New Issue
Block a user