From a338f012ed375035839af8e38a249f07043c48a0 Mon Sep 17 00:00:00 2001 From: Roland Sherwin Date: Mon, 10 Jun 2024 21:24:21 +0530 Subject: [PATCH] chore: remove some useless logs --- sn_networking/src/event/swarm.rs | 15 ++++++++++----- sn_networking/src/relay_manager.rs | 8 ++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/sn_networking/src/event/swarm.rs b/sn_networking/src/event/swarm.rs index 67c7b76c36..d7879954d3 100644 --- a/sn_networking/src/event/swarm.rs +++ b/sn_networking/src/event/swarm.rs @@ -569,6 +569,16 @@ impl SwarmDriver { if port == our_port { info!(%address, "external address: new candidate has the same configured port, adding it."); self.swarm.add_external_address(address); + + if tracing::level_enabled!(tracing::Level::TRACE) { + let all_external_addresses = + self.swarm.external_addresses().collect_vec(); + let all_listeners = self.swarm.listeners().collect_vec(); + trace!("All our listeners: {all_listeners:?}"); + trace!( + "All our external addresses: {all_external_addresses:?}" + ); + } } else { info!(%address, %our_port, "external address: new candidate has a different port, not adding it."); } @@ -577,10 +587,6 @@ impl SwarmDriver { trace!("external address: listen port not set. This has to be set if you're running a node"); } } - let all_external_addresses = self.swarm.external_addresses().collect_vec(); - let all_listeners = self.swarm.listeners().collect_vec(); - trace!("All our listeners: {all_listeners:?}"); - trace!("All our external addresses: {all_external_addresses:?}"); } SwarmEvent::ExternalAddrConfirmed { address } => { event_string = "ExternalAddrConfirmed"; @@ -677,7 +683,6 @@ impl SwarmDriver { shall_removed.len(), self.live_connected_peers.len() ); - trace!(?self.relay_manager); for (connection_id, peer_id) in shall_removed { let _ = self.live_connected_peers.remove(&connection_id); diff --git a/sn_networking/src/relay_manager.rs b/sn_networking/src/relay_manager.rs index 8eca2ad436..1f1d123019 100644 --- a/sn_networking/src/relay_manager.rs +++ b/sn_networking/src/relay_manager.rs @@ -7,6 +7,7 @@ // permissions and limitations relating to use of the SAFE Network Software. use crate::driver::{BadNodes, NodeBehaviour}; +use itertools::Itertools; use libp2p::{ core::transport::ListenerId, multiaddr::Protocol, Multiaddr, PeerId, StreamProtocol, Swarm, }; @@ -205,6 +206,13 @@ impl RelayManager { peer_id: &PeerId, swarm: &mut Swarm, ) { + if tracing::level_enabled!(tracing::Level::TRACE) { + let all_external_addresses = swarm.external_addresses().collect_vec(); + let all_listeners = swarm.listeners().collect_vec(); + trace!("All our listeners: {all_listeners:?}"); + trace!("All our external addresses: {all_external_addresses:?}"); + } + match self.waiting_for_reservation.remove(peer_id) { Some(addr) => { info!("Successfully made reservation with {peer_id:?} on {addr:?}. Adding the addr to external address.");