mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
Fix potential state mismatch in behaviour.rs (#6013)
* Fix state mismatch in behaviour.rs * Add TODO
This commit is contained in:
@@ -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
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user