node.cpp: Fix possible race condition in process_backlog_of_sync_blocks() #1434
This commit is contained in:
parent
f66eeeb73b
commit
a9de7c1da3
1 changed files with 5 additions and 2 deletions
|
|
@ -3306,6 +3306,7 @@ namespace graphene { namespace net { namespace detail {
|
|||
else
|
||||
{
|
||||
dlog("Already received and accepted this block (presumably through normal inventory mechanism), treating it as accepted");
|
||||
std::vector< peer_connection_ptr > peers_needing_next_batch;
|
||||
for (const peer_connection_ptr& peer : _active_connections)
|
||||
{
|
||||
auto items_being_processed_iter = peer->ids_of_items_being_processed.find(received_block_iter->block_id);
|
||||
|
|
@ -3323,11 +3324,13 @@ namespace graphene { namespace net { namespace detail {
|
|||
peer->ids_of_items_being_processed.empty())
|
||||
{
|
||||
dlog("We received last item in our list for peer ${endpoint}, setup to do a sync check", ("endpoint", peer->get_remote_endpoint()));
|
||||
peers_needing_next_batch.push_back( peer );
|
||||
}
|
||||
}
|
||||
}
|
||||
for( const peer_connection_ptr& peer : peers_needing_next_batch )
|
||||
fetch_next_batch_of_item_ids_from_peer(peer.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break; // start iterating _received_sync_items from the beginning
|
||||
} // end if potential_first_block
|
||||
|
|
|
|||
Loading…
Reference in a new issue