mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
Clarify comments around outbound peer eviction
This commit is contained in:
parent
daffaf03fb
commit
b3a515c0be
1 changed files with 5 additions and 4 deletions
|
@ -3953,10 +3953,10 @@ void PeerManager::EvictExtraOutboundPeers(int64_t time_in_seconds)
|
|||
});
|
||||
}
|
||||
|
||||
// Check whether we have too many outbound peers
|
||||
// Check whether we have too many OUTBOUND_FULL_RELAY peers
|
||||
if (m_connman.GetExtraFullOutboundCount() > 0) {
|
||||
// If we have more outbound peers than we target, disconnect one.
|
||||
// Pick the outbound peer that least recently announced
|
||||
// If we have more OUTBOUND_FULL_RELAY peers than we target, disconnect one.
|
||||
// Pick the OUTBOUND_FULL_RELAY peer that least recently announced
|
||||
// us a new block, with ties broken by choosing the more recent
|
||||
// connection (higher node id)
|
||||
NodeId worst_peer = -1;
|
||||
|
@ -3965,7 +3965,8 @@ void PeerManager::EvictExtraOutboundPeers(int64_t time_in_seconds)
|
|||
m_connman.ForEachNode([&](CNode* pnode) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) {
|
||||
AssertLockHeld(::cs_main);
|
||||
|
||||
// Ignore non-outbound peers, or nodes marked for disconnect already
|
||||
// Only consider OUTBOUND_FULL_RELAY peers that are not already
|
||||
// marked for disconnection
|
||||
if (!pnode->IsFullOutboundConn() || pnode->fDisconnect) return;
|
||||
CNodeState *state = State(pnode->GetId());
|
||||
if (state == nullptr) return; // shouldn't be possible, but just in case
|
||||
|
|
Loading…
Add table
Reference in a new issue