diff options
author | anon <anon [at] nowhere> | 2021-09-20 20:58:24 +0000 |
---|---|---|
committer | anon <anon [at] nowhere> | 2021-09-20 20:58:24 +0000 |
commit | d4c754923e7af4119c00fe9949c2defa4e6fd9bd (patch) | |
tree | 1a4f37574986f82498d183a9cf64e2d44e927d4d /src/p2p | |
parent | node_server: add race condition demo (diff) | |
download | monero-d4c754923e7af4119c00fe9949c2defa4e6fd9bd.tar.xz |
node_server: fix race condition
Diffstat (limited to 'src/p2p')
-rw-r--r-- | src/p2p/net_node.h | 6 | ||||
-rw-r--r-- | src/p2p/net_node.inl | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h index 59a6e5091..3660d2edb 100644 --- a/src/p2p/net_node.h +++ b/src/p2p/net_node.h @@ -111,15 +111,11 @@ namespace nodetool struct p2p_connection_context_t: base_type //t_payload_net_handler::connection_context //public net_utils::connection_context_base { p2p_connection_context_t() - : fluff_txs(), - flush_time(std::chrono::steady_clock::time_point::max()), - peer_id(0), + : peer_id(0), support_flags(0), m_in_timedsync(false) {} - std::vector<cryptonote::blobdata> fluff_txs; - std::chrono::steady_clock::time_point flush_time; peerid_type peer_id; uint32_t support_flags; bool m_in_timedsync; diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index b8cf2d124..438b8ca11 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -1432,6 +1432,7 @@ namespace nodetool ape.first_seen = first_seen_stamp ? first_seen_stamp : time(nullptr); zone.m_peerlist.append_with_peer_anchor(ape); + zone.m_notifier.on_handshake_complete(con->m_connection_id, con->m_is_income); zone.m_notifier.new_out_connection(); LOG_DEBUG_CC(*con, "CONNECTION HANDSHAKED OK."); @@ -2559,6 +2560,8 @@ namespace nodetool return 1; } + zone.m_notifier.on_handshake_complete(context.m_connection_id, context.m_is_income); + if(has_too_many_connections(context.m_remote_address)) { LOG_PRINT_CCONTEXT_L1("CONNECTION FROM " << context.m_remote_address.host_str() << " REFUSED, too many connections from the same address"); @@ -2683,6 +2686,9 @@ namespace nodetool zone.m_peerlist.remove_from_peer_anchor(na); } + if (!zone.m_net_server.is_stop_signal_sent()) { + zone.m_notifier.on_connection_close(context.m_connection_id); + } m_payload_handler.on_connection_close(context); MINFO("["<< epee::net_utils::print_connection_context(context) << "] CLOSE CONNECTION"); |