From e5777faa7d045b2d4ba304c58b5b2252a70d408c Mon Sep 17 00:00:00 2001 From: Eric Frias Date: Fri, 18 Sep 2015 09:39:20 -0400 Subject: [PATCH] Reduce the disconnection timeout in the p2p code for when a peer offers us a block and doesn't respond, now it's one block interval, down from three. This is intended to reduce the chance of a slow peer causing us to push blocks out of order. --- libraries/net/node.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/net/node.cpp b/libraries/net/node.cpp index c109b434..9af8c217 100644 --- a/libraries/net/node.cpp +++ b/libraries/net/node.cpp @@ -1292,11 +1292,11 @@ namespace graphene { namespace net { namespace detail { // timeout for any active peers is two block intervals uint32_t active_disconnect_timeout = 10 * current_block_interval_in_seconds; - uint32_t active_send_keepalive_timeount = active_disconnect_timeout / 2; - uint32_t active_ignored_request_timeount = 3 * current_block_interval_in_seconds; + uint32_t active_send_keepalive_timeout = active_disconnect_timeout / 2; + uint32_t active_ignored_request_timeout = current_block_interval_in_seconds; fc::time_point active_disconnect_threshold = fc::time_point::now() - fc::seconds(active_disconnect_timeout); - fc::time_point active_send_keepalive_threshold = fc::time_point::now() - fc::seconds(active_send_keepalive_timeount); - fc::time_point active_ignored_request_threshold = fc::time_point::now() - fc::seconds(active_ignored_request_timeount); + fc::time_point active_send_keepalive_threshold = fc::time_point::now() - fc::seconds(active_send_keepalive_timeout); + fc::time_point active_ignored_request_threshold = fc::time_point::now() - fc::seconds(active_ignored_request_timeout); for( const peer_connection_ptr& active_peer : _active_connections ) { if( active_peer->connection_initiation_time < active_disconnect_threshold && @@ -1346,7 +1346,7 @@ namespace graphene { namespace net { namespace detail { active_peer->get_last_message_received_time() < active_send_keepalive_threshold) { wlog( "Sending a keepalive message to peer ${peer} who hasn't sent us any messages in the last ${timeout} seconds", - ( "peer", active_peer->get_remote_endpoint() )("timeout", active_send_keepalive_timeount ) ); + ( "peer", active_peer->get_remote_endpoint() )("timeout", active_send_keepalive_timeout ) ); peers_to_send_keep_alive.push_back(active_peer); } }