From 5f43d26b5b0bf31b9408490e4d49d98a2f5f6074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Mon, 8 Jan 2024 13:36:06 +0000 Subject: [PATCH] improve logging to understand why connection fetching was panicing --- protocols/gossipsub/src/behaviour.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index 2ec65bd7ece0..601ed7ed9805 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -3037,7 +3037,7 @@ where // Add the new connection connected_peer.connections.push(connection_id); - tracing::debug!(%peer_id, "Established inbound connection to peer"); + tracing::info!(%peer_id, %connection_id, "Established inbound connection to peer"); Ok(Handler::new( self.config.protocol_config(), connected_peer.sender.new_receiver(), @@ -3068,7 +3068,7 @@ where // Add the new connection connected_peer.connections.push(connection_id); - tracing::debug!(%peer_id, "Established outbound connection to peer"); + tracing::info!(%peer_id, %connection_id, "Established inbound connection to peer"); Ok(Handler::new( self.config.protocol_config(), connected_peer.sender.new_receiver(), @@ -3284,11 +3284,14 @@ where if let Some(index) = peer.connections.iter().position(|v| v == &connection_id) { + tracing::info!(%peer_id, %connection_id, "Removed connection from connected peers"); peer.connections.remove(index); } if !peer.connections.is_empty() { self.connected_peers.insert(peer_id, peer); + } else { + tracing::info!(%peer_id, %connection_id, "Removed peer from connected peers"); } } }