Extra timeout handling in block_requests (#5794)

This commit is contained in:
Pierre Krieger
2020-04-27 12:17:26 +02:00
committed by GitHub
parent fbc4e7f055
commit 636ddd95d2
2 changed files with 229 additions and 12 deletions
+10
View File
@@ -261,6 +261,16 @@ impl<B: BlockT, H: ExHashT> NetworkBehaviourEventProcess<block_requests::Event<B
let ev = self.substrate.on_block_response(peer, original_request, response);
self.inject_event(ev);
}
block_requests::Event::RequestCancelled { .. } => {
// There doesn't exist any mechanism to report cancellations yet.
// We would normally disconnect the node, but this event happens as the result of
// a disconnect, so there's nothing more to do.
}
block_requests::Event::RequestTimeout { peer, .. } => {
// There doesn't exist any mechanism to report timeouts yet, so we process them by
// disconnecting the node.
self.substrate.disconnect_peer(&peer);
}
}
}
}