From 1ca5e8856b6cabbdb42c4e8a4de23d8435957197 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 7 Dec 2020 10:10:21 +0100 Subject: [PATCH] Fix two potential connection poisonings (#7677) --- .../client/network/src/protocol/generic_proto/behaviour.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/substrate/client/network/src/protocol/generic_proto/behaviour.rs b/substrate/client/network/src/protocol/generic_proto/behaviour.rs index 51d7252d5f..b8b4cce0a7 100644 --- a/substrate/client/network/src/protocol/generic_proto/behaviour.rs +++ b/substrate/client/network/src/protocol/generic_proto/behaviour.rs @@ -1565,6 +1565,7 @@ impl NetworkBehaviour for GenericProto { connec_state, ConnectionState::OpeningThenClosing )); + *entry.into_mut() = PeerState::Disabled { connections, backoff_until }; } } else { error!( @@ -1652,6 +1653,7 @@ impl NetworkBehaviour for GenericProto { }; if matches!(connections[pos].1, ConnectionState::Closing) { + *entry.into_mut() = PeerState::Enabled { connections }; return; } @@ -1683,7 +1685,7 @@ impl NetworkBehaviour for GenericProto { notifications_sink: replacement_sink, }; self.events.push_back(NetworkBehaviourAction::GenerateEvent(event)); - *entry.into_mut() = PeerState::Enabled { connections, }; + *entry.into_mut() = PeerState::Enabled { connections }; } } else {