Browse Source

Refactor: Move failure conditions to the top of AcceptConnection

0.13
Patrick Strateman 9 years ago
parent
commit
ae037b707c
  1. 12
      src/net.cpp

12
src/net.cpp

@ -811,23 +811,23 @@ static void AcceptConnection(const ListenSocket& hListenSocket) { @@ -811,23 +811,23 @@ static void AcceptConnection(const ListenSocket& hListenSocket) {
return;
}
if (nInbound >= nMaxInbound)
if (CNode::IsBanned(addr) && !whitelisted)
{
LogPrint("net", "connection from %s dropped (full)\n", addr.ToString());
LogPrintf("connection from %s dropped (banned)\n", addr.ToString());
CloseSocket(hSocket);
return;
}
if (!whitelisted && (nInbound >= (nMaxInbound - nWhiteConnections)))
if (nInbound >= nMaxInbound)
{
LogPrint("net", "connection from %s dropped (non-whitelisted)\n", addr.ToString());
LogPrint("net", "connection from %s dropped (full)\n", addr.ToString());
CloseSocket(hSocket);
return;
}
if (CNode::IsBanned(addr) && !whitelisted)
if (!whitelisted && (nInbound >= (nMaxInbound - nWhiteConnections)))
{
LogPrintf("connection from %s dropped (banned)\n", addr.ToString());
LogPrint("net", "connection from %s dropped (non-whitelisted)\n", addr.ToString());
CloseSocket(hSocket);
return;
}

Loading…
Cancel
Save