mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-07 17:00:32 +02:00
[net processing] Move PoissonNextSendInbound to PeerManager
This commit is contained in:
committed by
Martin Zumsande
parent
bb060746df
commit
ea99f5d01e
11
src/net.cpp
11
src/net.cpp
@ -3058,17 +3058,6 @@ bool CConnman::ForNode(NodeId id, std::function<bool(CNode* pnode)> func)
|
||||
return found != nullptr && NodeFullyConnected(found) && func(found);
|
||||
}
|
||||
|
||||
std::chrono::microseconds CConnman::PoissonNextSendInbound(std::chrono::microseconds now, std::chrono::seconds average_interval)
|
||||
{
|
||||
if (m_next_send_inv_to_incoming.load() < now) {
|
||||
// If this function were called from multiple threads simultaneously
|
||||
// it would possible that both update the next send variable, and return a different result to their caller.
|
||||
// This is not possible in practice as only the net processing thread invokes this function.
|
||||
m_next_send_inv_to_incoming = GetExponentialRand(now, average_interval);
|
||||
}
|
||||
return m_next_send_inv_to_incoming;
|
||||
}
|
||||
|
||||
CSipHasher CConnman::GetDeterministicRandomizer(uint64_t id) const
|
||||
{
|
||||
return CSipHasher(nSeed0, nSeed1).Write(id);
|
||||
|
Reference in New Issue
Block a user