mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
[net processing] Move PoissonNextSendInbound to PeerManager
This commit is contained in:
parent
bb060746df
commit
ea99f5d01e
4 changed files with 24 additions and 26 deletions
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue