Skip to content
This repository has been archived by the owner on Dec 29, 2018. It is now read-only.

Commit

Permalink
node.cpp: Fix possible race condition in process_backlog_of_sync_bloc…
Browse files Browse the repository at this point in the history
…ks() #1434
  • Loading branch information
theoreticalbts authored and pmconrad committed Jan 17, 2018
1 parent b698809 commit faf1c68
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libraries/net/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3303,6 +3303,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);
Expand All @@ -3320,10 +3321,12 @@ 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()));
fetch_next_batch_of_item_ids_from_peer(peer.get());
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
Expand Down

0 comments on commit faf1c68

Please sign in to comment.