Refactor: Move failure conditions to the top of AcceptConnection
This commit is contained in:
committed by
Taylor Hornby
parent
12005016cd
commit
bd80ec0d23
14
src/net.cpp
14
src/net.cpp
@@ -706,6 +706,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());
|
||||||
@@ -720,13 +727,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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// According to the internet TCP_NODELAY is not carried into accepted sockets
|
// According to the internet TCP_NODELAY is not carried into accepted sockets
|
||||||
// on all platforms. Set it again here just to be sure.
|
// on all platforms. Set it again here just to be sure.
|
||||||
int set = 1;
|
int set = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user