Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IF: P2P: Send handshake to peer to let it know it is not syncing from peer #22

Merged
merged 2 commits into from
Apr 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading