mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-22 19:39:22 +00:00
Use steady_clock to time peer list requests
This commit is contained in:
parent
aada1bb5cc
commit
f4bcdc7fe9
1 changed files with 3 additions and 2 deletions
|
@ -285,6 +285,7 @@ void P2PServer::update_peer_connections()
|
|||
|
||||
void P2PServer::update_peer_list()
|
||||
{
|
||||
const uint64_t cur_time = seconds_since_epoch();
|
||||
{
|
||||
MutexLock lock(m_clientsListLock);
|
||||
|
||||
|
@ -293,9 +294,9 @@ void P2PServer::update_peer_list()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (m_timerCounter >= client->m_nextOutgoingPeerListRequest) {
|
||||
if (cur_time >= client->m_nextOutgoingPeerListRequest) {
|
||||
// Send peer list requests at random intervals (60-120 seconds)
|
||||
client->m_nextOutgoingPeerListRequest = m_timerCounter + (60 + (get_random64() % 61)) / m_timerInterval;
|
||||
client->m_nextOutgoingPeerListRequest = cur_time + (60 + (get_random64() % 61));
|
||||
|
||||
const bool result = send(client,
|
||||
[](void* buf)
|
||||
|
|
Loading…
Reference in a new issue