aboutsummaryrefslogtreecommitdiff
path: root/src/p2p
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-09-21 10:11:33 +0200
committerRiccardo Spagni <ric@spagni.net>2017-09-21 10:11:33 +0200
commit07312a7d6e97b792757d324601c95620996715b2 (patch)
tree8647526e16c1ae381fbce5bd30e77e373673bbc7 /src/p2p
parentMerge pull request #2441 (diff)
parentp2p: add a couple early outs when the stop signal is received (diff)
downloadmonero-07312a7d6e97b792757d324601c95620996715b2.tar.xz
Merge pull request #2302
ef005f5e p2p: add a couple early outs when the stop signal is received (moneromooo-monero) 80d361c7 abstract_tcp_server2: improve tracking/cancelling of early connections (moneromooo-monero)
Diffstat (limited to 'src/p2p')
-rw-r--r--src/p2p/net_node.inl5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 13352c24a..7da123633 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -1090,6 +1090,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 {
@@ -1916,6 +1918,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;
}