mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
[net] remove fUpdateConnectionTime from FinalizeNode
PeerManager can just call directly into CAddrMan::Connected() now.
This commit is contained in:
@@ -238,7 +238,7 @@ public:
|
||||
|
||||
/** Implement NetEventsInterface */
|
||||
void InitializeNode(CNode* pnode) override;
|
||||
void FinalizeNode(const CNode& node, bool& fUpdateConnectionTime) override;
|
||||
void FinalizeNode(const CNode& node) override;
|
||||
bool ProcessMessages(CNode* pfrom, std::atomic<bool>& interrupt) override;
|
||||
bool SendMessages(CNode* pto) override EXCLUSIVE_LOCKS_REQUIRED(pto->cs_sendProcessing);
|
||||
|
||||
@@ -969,12 +969,12 @@ void PeerManagerImpl::ReattemptInitialBroadcast(CScheduler& scheduler)
|
||||
scheduler.scheduleFromNow([&] { ReattemptInitialBroadcast(scheduler); }, delta);
|
||||
}
|
||||
|
||||
void PeerManagerImpl::FinalizeNode(const CNode& node, bool& fUpdateConnectionTime)
|
||||
void PeerManagerImpl::FinalizeNode(const CNode& node)
|
||||
{
|
||||
NodeId nodeid = node.GetId();
|
||||
fUpdateConnectionTime = false;
|
||||
LOCK(cs_main);
|
||||
int misbehavior{0};
|
||||
{
|
||||
LOCK(cs_main);
|
||||
{
|
||||
// We remove the PeerRef from g_peer_map here, but we don't always
|
||||
// destruct the Peer. Sometimes another thread is still holding a
|
||||
@@ -991,12 +991,6 @@ void PeerManagerImpl::FinalizeNode(const CNode& node, bool& fUpdateConnectionTim
|
||||
if (state->fSyncStarted)
|
||||
nSyncStarted--;
|
||||
|
||||
if (node.fSuccessfullyConnected && misbehavior == 0 &&
|
||||
!node.IsBlockOnlyConn() && !node.IsInboundConn()) {
|
||||
// Only change visible addrman state for outbound, full-relay peers
|
||||
fUpdateConnectionTime = true;
|
||||
}
|
||||
|
||||
for (const QueuedBlock& entry : state->vBlocksInFlight) {
|
||||
mapBlocksInFlight.erase(entry.hash);
|
||||
}
|
||||
@@ -1021,6 +1015,14 @@ void PeerManagerImpl::FinalizeNode(const CNode& node, bool& fUpdateConnectionTim
|
||||
assert(m_wtxid_relay_peers == 0);
|
||||
assert(m_txrequest.Size() == 0);
|
||||
}
|
||||
} // cs_main
|
||||
if (node.fSuccessfullyConnected && misbehavior == 0 &&
|
||||
!node.IsBlockOnlyConn() && !node.IsInboundConn()) {
|
||||
// Only change visible addrman state for full outbound peers. We don't
|
||||
// call Connected() for feeler connections since they don't have
|
||||
// fSuccessfullyConnected set.
|
||||
m_addrman.Connected(node.addr);
|
||||
}
|
||||
LogPrint(BCLog::NET, "Cleared nodestate for peer=%d\n", nodeid);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user