Skip to content

Commit 738e036

Browse files
committed
Fix off by one error in peer re-connect logic
1 parent 3778705 commit 738e036

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

overlay/src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,11 @@ impl App {
546546
let cp = self.configured_peers.read().await;
547547
let addrs = cp.addrs.clone();
548548
let listen_port = cp.listen_port;
549-
let expected_peers = addrs.len().saturating_sub(1); // exclude self
549+
// Expect a connection for every configured address. Self is
550+
// not normally in the list; if it is, the extra safety-net
551+
// tick is harmless (self-dials and connected peers are
552+
// skipped when re-dialing).
553+
let expected_peers = addrs.len();
550554
// Build set of hostnames that have a known PeerId — these
551555
// are handled by PeerId-based dials and must NOT be raw-dialed.
552556
let hostnames_with_known_peer: HashSet<String> = {

0 commit comments

Comments
 (0)