Fix invalid state after peer id mismatch (#503)

This commit is contained in:
Pierre Krieger
2018-09-21 09:32:23 +02:00
committed by GitHub
parent 4d8da24c64
commit a910797f22

View File

@ -511,6 +511,10 @@ where
let num_remain = attempt.next_attempts.len();
let failed_addr = attempt.cur_attempted.clone();
// Note: at the moment, a peer id mismatch can drop a legitimate connection, which is
// why we have to purge `connected_multiaddresses`.
// See https://github.com/libp2p/rust-libp2p/issues/502
self.connected_multiaddresses.remove(&peer_id);
self.active_nodes.peer_mut(&peer_id)
.expect("When we receive a NodeReached or NodeReplaced event from active_nodes, \
it is guaranteed that the PeerId is valid and therefore that \