From a3c37cba21a09cf29db64b2b931971c48a6f7568 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Sun, 21 Apr 2024 08:02:13 -0400 Subject: [PATCH] Replace expect with debug log --- coordinator/src/p2p.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/coordinator/src/p2p.rs b/coordinator/src/p2p.rs index 85251dc7..81c43555 100644 --- a/coordinator/src/p2p.rs +++ b/coordinator/src/p2p.rs @@ -541,10 +541,10 @@ impl LibP2p { } Some(SwarmEvent::ConnectionClosed { peer_id, endpoint, .. }) => { let mut connected_peers = connected_peers.write().await; - let nets = - connected_peers - .remove(endpoint.get_remote_address()) - .expect("closed connection to peer which never connected"); + let Some(nets) = connected_peers.remove(endpoint.get_remote_address()) else { + log::debug!("closed connection to peer which wasn't in connected_peers"); + continue; + }; // Downgrade to a read lock let connected_peers = connected_peers.downgrade();