Forgot to handle Banned in inject_connected (#2107)

* Forgot to handle Banned in inject_connected

* Also add debug for the state
This commit is contained in:
Pierre Krieger
2019-03-25 14:48:43 +01:00
committed by Gav Wood
parent c6addc9bd5
commit 4fe70ee639
@@ -571,7 +571,8 @@ where
match (self.peers.entry(peer_id), connected_point) {
(Entry::Occupied(mut entry), connected_point) => {
match mem::replace(entry.get_mut(), PeerState::Poisoned) {
PeerState::Requested | PeerState::PendingRequest { .. } => {
PeerState::Requested | PeerState::PendingRequest { .. } |
PeerState::Banned { .. } => {
debug!(target: "sub-libp2p", "Libp2p => Connected({:?}): Connection \
requested by PSM (through {:?})", entry.key(), connected_point);
debug!(target: "sub-libp2p", "Handler({:?}) <= Enable", entry.key());
@@ -584,7 +585,7 @@ where
st @ _ => {
// This is a serious bug either in this state machine or in libp2p.
error!(target: "sub-libp2p", "Received inject_connected for \
already-connected node");
already-connected node; state is {:?}", st);
*entry.into_mut() = st;
return
}