Skip to content

Commit

Permalink
improve logging to understand why connection fetching was panicing
Browse files Browse the repository at this point in the history
  • Loading branch information
jxs committed Jan 8, 2024
1 parent b64bb06 commit 5f43d26
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions protocols/gossipsub/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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");
}
}
}
Expand Down

0 comments on commit 5f43d26

Please sign in to comment.