From 82dbeedd1bb92a6db31b2e887fee59b4382dc582 Mon Sep 17 00:00:00 2001 From: Miguel Herranz Date: Sat, 21 Jan 2017 00:59:04 +0100 Subject: Add gray peer list housekeeping system A random peer from the gray peer list is selected and a connection is made to check if the peer is alive. If the connection and handshake are successful the peer is promoted to the white peer list, in case of failure the peer is evicted from the gray peer list. The connection is closed after the check in either case. --- src/p2p/net_node.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/p2p/net_node.h') diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h index 3f5a5ad93..f5309b1c3 100644 --- a/src/p2p/net_node.h +++ b/src/p2p/net_node.h @@ -229,6 +229,9 @@ namespace nodetool bool has_too_many_connections(const uint32_t ip); + bool check_connection_and_handshake_with_peer(const net_address& na, uint64_t last_seen_stamp); + bool gray_peerlist_housekeeping(); + void kill() { ///< will be called e.g. from deinit() _info("Killing the net_node"); is_closing = true; @@ -289,6 +292,7 @@ namespace nodetool epee::math_helper::once_a_time_seconds m_peer_handshake_idle_maker_interval; epee::math_helper::once_a_time_seconds<1> m_connections_maker_interval; epee::math_helper::once_a_time_seconds<60*30, false> m_peerlist_store_interval; + epee::math_helper::once_a_time_seconds<60> m_gray_peerlist_housekeeping_interval; std::string m_bind_ip; std::string m_port; -- cgit v1.2.3