diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-08-16 15:44:52 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-08-16 15:44:52 +0100 |
commit | ef005f5e7228cafc9c568e1c58a1e5a7e17d111a (patch) | |
tree | 009f14c3c3166b17989326cc8efdd3cb97645ab7 /src/p2p/net_node.inl | |
parent | abstract_tcp_server2: improve tracking/cancelling of early connections (diff) | |
download | monero-ef005f5e7228cafc9c568e1c58a1e5a7e17d111a.tar.xz |
p2p: add a couple early outs when the stop signal is received
This avoids quicker exit
Diffstat (limited to '')
-rw-r--r-- | src/p2p/net_node.inl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index e179fc14f..f87ab5e83 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -1127,6 +1127,8 @@ namespace nodetool if (use_white_list) { 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); random_index = get_random_index_with_fixed_probability(max_random_index); } else { @@ -1951,6 +1953,9 @@ namespace nodetool { 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)) { return false; } |