From ae037b707ce164087790f149c048871c66e14cfd Mon Sep 17 00:00:00 2001 From: Patrick Strateman Date: Thu, 13 Aug 2015 02:19:17 -0700 Subject: Refactor: Move failure conditions to the top of AcceptConnection --- src/net.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/net.cpp b/src/net.cpp index 6214c754c3..248aedfa12 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -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; } -- cgit v1.2.3