diff options
| author | tv <tv@krebsco.de> | 2026-10-26 17:50:58 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-26 17:50:58 +0100 |
| commit | c64c2d283ae99581bf5f06fed0303f7f2d82f980 (patch) | |
| tree | 31940b8c9ef8a3ca3e1af58b588ca4dc435efed2 /src/state/timing.rs | |
| parent | 03807a3c7b33c67293f496b4f1222719113f80bb (diff) | |
unreachability doesn't expire
Diffstat (limited to 'src/state/timing.rs')
| -rw-r--r-- | src/state/timing.rs | 10 |
1 files changed, 10 insertions, 0 deletions
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( |
