From c64c2d283ae99581bf5f06fed0303f7f2d82f980 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 26 Oct 2026 17:50:58 +0100 Subject: unreachability doesn't expire --- src/state/timing.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/state/timing.rs') diff --git a/src/state/timing.rs b/src/state/timing.rs index 406e207..c2993d7 100644 --- a/src/state/timing.rs +++ b/src/state/timing.rs @@ -10,6 +10,10 @@ const SYNC_REPLY_TIMEOUT: Duration = Duration::from_secs(10); /// Upper bound, as a multiple of the first wait: 5 minutes (Mycelium gives up on a /// message after five minutes). const SYNC_REPLY_TIMEOUT_MAX_FACTOR: u32 = 30; +/// Upper bound on the wait between probes of an unreachable peer, as a multiple of +/// `dormant_probe`: an hour at the default keepalive (1m). A returning node HELLOs its own +/// neighbours, so this only bounds how long one we never hear from stays out. +const PROBE_MAX_FACTOR: u32 = 6; /// How long Mycelium tries to deliver a message before dropping it. const MYCELIUM_DELIVERY_LIMIT: Duration = Duration::from_secs(300); @@ -65,6 +69,12 @@ impl Timing { } } + /// Waits between probes of an unreachable peer: `dormant_probe`, doubling up to + /// `PROBE_MAX_FACTOR` times as much. + pub(crate) fn probe_backoff(&self) -> Backoff { + Backoff::new(self.dormant_probe, self.dormant_probe * PROBE_MAX_FACTOR) + } + /// Waits for sync answers: `sync_reply_timeout`, doubling up to 30 times as much. pub(crate) fn sync_reply_backoff(&self) -> Backoff { Backoff::new( -- cgit v1.3.1