mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-12-25 06:37:46 +00:00
Merge pull request #5103
ceb72be3
p2p: avoid busy loop when we have nothing to connect to (moneromooo-monero)
This commit is contained in:
commit
5b9c3df5c1
1 changed files with 9 additions and 1 deletions
|
@ -1398,7 +1398,15 @@ namespace nodetool
|
||||||
}
|
}
|
||||||
if(zone.second.m_net_server.is_stop_signal_sent())
|
if(zone.second.m_net_server.is_stop_signal_sent())
|
||||||
return false;
|
return false;
|
||||||
conn_count = get_outgoing_connections_count(zone.second);
|
size_t new_conn_count = get_outgoing_connections_count(zone.second);
|
||||||
|
if (new_conn_count <= conn_count)
|
||||||
|
{
|
||||||
|
// we did not make any connection, sleep a bit to avoid a busy loop in case we don't have
|
||||||
|
// any peers to try, then break so we will try seeds to get more peers
|
||||||
|
boost::this_thread::sleep_for(boost::chrono::seconds(1));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
conn_count = new_conn_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue