mirror of
https://github.com/monero-project/monero.git
synced 2024-12-27 02:19:24 -05:00
p2p: add a couple early outs when the stop signal is received
This avoids quicker exit
This commit is contained in:
parent
80d361c795
commit
ef005f5e72
@ -1127,6 +1127,8 @@ namespace nodetool
|
|||||||
|
|
||||||
if (use_white_list) {
|
if (use_white_list) {
|
||||||
local_peers_count = m_peerlist.get_white_peers_count();
|
local_peers_count = m_peerlist.get_white_peers_count();
|
||||||
|
if (!local_peers_count)
|
||||||
|
return false;
|
||||||
max_random_index = std::min<uint64_t>(local_peers_count -1, 20);
|
max_random_index = std::min<uint64_t>(local_peers_count -1, 20);
|
||||||
random_index = get_random_index_with_fixed_probability(max_random_index);
|
random_index = get_random_index_with_fixed_probability(max_random_index);
|
||||||
} else {
|
} else {
|
||||||
@ -1951,6 +1953,9 @@ namespace nodetool
|
|||||||
{
|
{
|
||||||
peerlist_entry pe = AUTO_VAL_INIT(pe);
|
peerlist_entry pe = AUTO_VAL_INIT(pe);
|
||||||
|
|
||||||
|
if (m_net_server.is_stop_signal_sent())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!m_peerlist.get_random_gray_peer(pe)) {
|
if (!m_peerlist.get_random_gray_peer(pe)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user