mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-13 19:50:43 +02:00
Clarify comments around outbound peer eviction
This commit is contained in:
parent
daffaf03fb
commit
b3a515c0be
@ -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 (m_connman.GetExtraFullOutboundCount() > 0) {
|
||||||
// If we have more outbound peers than we target, disconnect one.
|
// If we have more OUTBOUND_FULL_RELAY peers than we target, disconnect one.
|
||||||
// Pick the outbound peer that least recently announced
|
// Pick the OUTBOUND_FULL_RELAY peer that least recently announced
|
||||||
// us a new block, with ties broken by choosing the more recent
|
// us a new block, with ties broken by choosing the more recent
|
||||||
// connection (higher node id)
|
// connection (higher node id)
|
||||||
NodeId worst_peer = -1;
|
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) {
|
m_connman.ForEachNode([&](CNode* pnode) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) {
|
||||||
AssertLockHeld(::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;
|
if (!pnode->IsFullOutboundConn() || pnode->fDisconnect) return;
|
||||||
CNodeState *state = State(pnode->GetId());
|
CNodeState *state = State(pnode->GetId());
|
||||||
if (state == nullptr) return; // shouldn't be possible, but just in case
|
if (state == nullptr) return; // shouldn't be possible, but just in case
|
||||||
|
Loading…
Reference in New Issue
Block a user