aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-12-15 10:28:15 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-12-15 10:31:12 +0000
commitd28c388f8892da2b459550a46a87a2756c7d4e73 (patch)
tree6e57b1adca1cb29461f0bc69fd8946e5ec22f5d5 /src
parentMerge pull request #2906 (diff)
downloadmonero-d28c388f8892da2b459550a46a87a2756c7d4e73.tar.xz
p2p: stop net server before closing starting connections
This fixes a hang on exit due to race where a connection adds itself to the server after the starting connections are closed, but before the net server marks itself as stopped.
Diffstat (limited to 'src')
-rw-r--r--src/p2p/net_node.inl7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index f64b29c1f..90a6d4332 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -686,6 +686,10 @@ namespace nodetool
template<class t_payload_net_handler>
bool node_server<t_payload_net_handler>::send_stop_signal()
{
+ MDEBUG("[node] sending stop signal");
+ m_net_server.send_stop_signal();
+ MDEBUG("[node] Stop signal sent");
+
std::list<boost::uuids::uuid> connection_ids;
m_net_server.get_config_object().foreach_connection([&](const p2p_connection_context& cntxt) {
connection_ids.push_back(cntxt.m_connection_id);
@@ -695,8 +699,7 @@ namespace nodetool
m_net_server.get_config_object().close(connection_id);
m_payload_handler.stop();
- m_net_server.send_stop_signal();
- MDEBUG("[node] Stop signal sent");
+
return true;
}
//-----------------------------------------------------------------------------------