From 4b65c22305ddabf9bef331a372971e0c81e0de74 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Thu, 4 Jul 2024 12:03:42 +0200 Subject: [PATCH] node: Fix logging on maintain connections We were comparing the available peers with the target, so the comparison would always succeed. We now compare it with the missing count, and use debug logging since it's not something of concern yet. --- radicle-node/src/service.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/radicle-node/src/service.rs b/radicle-node/src/service.rs index 88dd9106..dbd621e2 100644 --- a/radicle-node/src/service.rs +++ b/radicle-node/src/service.rs @@ -2536,6 +2536,7 @@ where return; } + // Peers available to connect to. let available = self .available_peers() .into_iter() @@ -2559,18 +2560,18 @@ where // Only consider onion addresses if configured. AddressType::Onion => self.config.onion.is_some(), AddressType::Dns | AddressType::Ipv4 | AddressType::Ipv6 => true, - }) - .take(wanted) - .collect::>(); + }); - if available.len() < target { - log::warn!( + // Peers we are going to attempt connections to. + let connect = available.take(wanted).collect::>(); + if connect.len() < wanted { + log::debug!( target: "service", - "Not enough available peers to connect to (available={}, target={target})", - available.len() + "Not enough available peers to connect to (available={}, wanted={wanted})", + connect.len() ); } - for (id, ka) in available { + for (id, ka) in connect { self.connect(id, ka.addr.clone()); } }