diff options
author | rfree2monero <rfreemonero@op.pl> | 2015-02-24 21:02:48 +0100 |
---|---|---|
committer | rfree2monero <rfreemonero@op.pl> | 2015-02-24 21:06:02 +0100 |
commit | f79821ac7ebc269b18dd2edd8ac0cb022861ad11 (patch) | |
tree | e7e1d625b0b1bfb2a6b9aea73f5a8115b55fca5e /src/p2p/net_node.h | |
parent | 2014 network limit 1.3 fix log/path/data +utils (diff) | |
download | monero-f79821ac7ebc269b18dd2edd8ac0cb022861ad11.tar.xz |
fix locking in count-peers thread (2)
Diffstat (limited to 'src/p2p/net_node.h')
-rw-r--r-- | src/p2p/net_node.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h index 5417ffa52..5b034ce25 100644 --- a/src/p2p/net_node.h +++ b/src/p2p/net_node.h @@ -89,6 +89,7 @@ namespace nodetool { m_current_number_of_out_peers = 0; m_save_graph = false; + is_closing = false; } static void init_options(boost::program_options::options_description& desc); @@ -209,6 +210,13 @@ namespace nodetool bool set_rate_down_limit(const boost::program_options::variables_map& vm, int64_t limit); bool set_rate_limit(const boost::program_options::variables_map& vm, uint64_t limit); + void kill() { ///< will be called e.g. from deinit() + _info("Killing the net_node"); + is_closing = true; + mPeersLoggerThread->join(); // make sure the thread finishes + _info("Joined extra background net_node threads"); + } + //debug functions std::string print_connections_container(); @@ -247,7 +255,8 @@ namespace nodetool bool m_hide_my_port; bool m_no_igd; std::atomic<bool> m_save_graph; - + std::atomic<bool> is_closing; + std::unique_ptr<std::thread> mPeersLoggerThread; //critical_section m_connections_lock; //connections_indexed_container m_connections; |