From e4b1c25b3eddbd73886735022c59f3c1707db608 Mon Sep 17 00:00:00 2001 From: stringhandler Date: Thu, 5 Dec 2024 19:36:34 +0200 Subject: [PATCH] fix: seek peers until we have 20 outgoing (#210) --- src/server/p2p/network.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/p2p/network.rs b/src/server/p2p/network.rs index 45f16ee..3bec7bd 100644 --- a/src/server/p2p/network.rs +++ b/src/server/p2p/network.rs @@ -1997,7 +1997,10 @@ where S: ShareChain _ = seek_connections_interval.tick() => { let timer = Instant::now(); if !self.config.is_seed_peer { - if self.swarm.connected_peers().count() > 20 { + let info = self.swarm.network_info(); + let counters = info.connection_counters(); + + if (counters.num_established_outgoing() + counters.num_pending_outgoing()) > 20 { continue; } let mut num_dialed = 0;