Skip to content

Commit

Permalink
Merge pull request #22 from AntelopeIO/net-sync-peer-fix
Browse files Browse the repository at this point in the history
IF: P2P: Send handshake to peer to let it know it is not syncing from peer
  • Loading branch information
heifner authored Apr 11, 2024
2 parents 8cc9420 + 76a79ab commit f5967c0
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 @@ -2203,7 +2203,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 @@ -2229,6 +2229,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 @@ -2318,8 +2319,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 @@ -2361,6 +2362,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 f5967c0

Please sign in to comment.