diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2020-09-01 16:32:09 -0400 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2020-12-10 08:41:57 -0500 |
commit | 91d61952a82af3e8887e8ae532ecc19d87fe9073 (patch) | |
tree | 7595a09515d4ec79e518b6536106967552fa6f29 /src/net.cpp | |
parent | 86f20071931b803b5f26ed8f685d98d4919fb7a7 (diff) | |
download | bitcoin-91d61952a82af3e8887e8ae532ecc19d87fe9073.tar.xz |
Simplify and clarify extra outbound peer counting
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/net.cpp b/src/net.cpp index bbb85694e7..fe1baf97a3 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1827,18 +1827,18 @@ void CConnman::SetTryNewOutboundPeer(bool flag) // Also exclude peers that haven't finished initial connection handshake yet // (so that we don't decide we're over our desired connection limit, and then // evict some peer that has finished the handshake) -int CConnman::GetExtraOutboundCount() +int CConnman::GetExtraFullOutboundCount() { - int nOutbound = 0; + int full_outbound_peers = 0; { LOCK(cs_vNodes); for (const CNode* pnode : vNodes) { - if (pnode->fSuccessfullyConnected && !pnode->fDisconnect && pnode->IsOutboundOrBlockRelayConn()) { - ++nOutbound; + if (pnode->fSuccessfullyConnected && !pnode->fDisconnect && pnode->IsFullOutboundConn()) { + ++full_outbound_peers; } } } - return std::max(nOutbound - m_max_outbound_full_relay - m_max_outbound_block_relay, 0); + return std::max(full_outbound_peers - m_max_outbound_full_relay, 0); } void CConnman::ThreadOpenConnections(const std::vector<std::string> connect) |