Skip to content

Commit

Permalink
Send handshake to peer to let it know it is not syncing from us.
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Apr 10, 2024
1 parent 99ee7a7 commit 5558668
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2185,7 +2185,7 @@ namespace eosio {
// static, thread safe
void sync_manager::send_handshakes() {
my_impl->connections.for_each_connection( []( const connection_ptr& ci ) {
if( ci->current() ) {
if( ci->connected() ) {
ci->send_handshake();
}
} );
Expand All @@ -2211,6 +2211,7 @@ namespace eosio {
if( !is_sync_required( chain_info.head_num ) || target <= chain_info.lib_num ) {
peer_dlog( c, "We are already caught up, my irr = ${b}, head = ${h}, target = ${t}",
("b", chain_info.lib_num)( "h", chain_info.head_num )( "t", target ) );
c->send_handshake(); // let peer know it is not syncing from us
return;
}

Expand Down Expand Up @@ -2300,8 +2301,8 @@ namespace eosio {
note.known_blocks.ids.push_back(make_block_id(cc.earliest_available_block_num()));
}
c->enqueue( note );
c->peer_syncing_from_us = true;
}
c->peer_syncing_from_us = true;
return;
}

Expand Down Expand Up @@ -2343,6 +2344,7 @@ namespace eosio {
}
return;
} else {
c->peer_syncing_from_us = false;
peer_dlog( c, "Block discrepancy is within network latency range.");
}
}
Expand Down

0 comments on commit 5558668

Please sign in to comment.