From a8fac92396833b5bd6c9539730430662855c49b5 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 7 May 2020 15:07:52 +0200 Subject: [PATCH] Disconnect node after sync request cancelled (#5945) --- substrate/client/network/src/behaviour.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/substrate/client/network/src/behaviour.rs b/substrate/client/network/src/behaviour.rs index 171acc9562..5a5dd83803 100644 --- a/substrate/client/network/src/behaviour.rs +++ b/substrate/client/network/src/behaviour.rs @@ -320,19 +320,10 @@ impl NetworkBehaviourEventProcess { - // 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. - self.events.push_back(BehaviourOut::RequestFinished { - peer, - protocol: self.block_requests.protocol_name().to_vec(), - request_duration, - }); - } + block_requests::Event::RequestCancelled { peer, request_duration, .. } | block_requests::Event::RequestTimeout { peer, request_duration, .. } => { - // There doesn't exist any mechanism to report timeouts yet, so we process them by - // disconnecting the node. + // There doesn't exist any mechanism to report cancellations or timeouts yet, so + // we process them by disconnecting the node. self.events.push_back(BehaviourOut::RequestFinished { peer: peer.clone(), protocol: self.block_requests.protocol_name().to_vec(),