diff options
author | Patrick Strateman <patrick.strateman@gmail.com> | 2015-08-13 02:19:17 -0700 |
---|---|---|
committer | Patrick Strateman <patrick.strateman@gmail.com> | 2015-08-22 15:38:23 -0700 |
commit | ae037b707ce164087790f149c048871c66e14cfd (patch) | |
tree | 83ec6a96f200bf98bc2a939634db1170ba9e81d2 | |
parent | 1ef481761477e26651dc56b4378b146cd5c416db (diff) |
Refactor: Move failure conditions to the top of AcceptConnection
-rw-r--r-- | src/net.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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; } |