diff --git a/substrate/client/network/src/protocol/generic_proto/behaviour.rs b/substrate/client/network/src/protocol/generic_proto/behaviour.rs index 361ef58980..7bb5d986ca 100644 --- a/substrate/client/network/src/protocol/generic_proto/behaviour.rs +++ b/substrate/client/network/src/protocol/generic_proto/behaviour.rs @@ -1123,25 +1123,25 @@ impl NetworkBehaviour for GenericProto { ); } + // TODO: We switch the entire peer state to "disabled" because of possible + // race conditions involving the legacy substream. + // Once https://github.com/paritytech/substrate/issues/5670 is done, this + // should be changed to stay in the `Enabled` state. debug!(target: "sub-libp2p", "Handler({:?}) <= Disable", source); + debug!(target: "sub-libp2p", "PSM <= Dropped({:?})", source); + self.peerset.dropped(source.clone()); self.events.push(NetworkBehaviourAction::NotifyHandler { peer_id: source.clone(), - handler: NotifyHandler::One(connection), + handler: NotifyHandler::All, event: NotifsHandlerIn::Disable, }); let last = open.is_empty(); - if last { - debug!(target: "sub-libp2p", "PSM <= Dropped({:?})", source); - self.peerset.dropped(source.clone()); - *entry.into_mut() = PeerState::Disabled { - open, - banned_until: None - }; - } else { - *entry.into_mut() = PeerState::Enabled { open }; - } + *entry.into_mut() = PeerState::Disabled { + open, + banned_until: None + }; last },