summaryrefslogtreecommitdiffstats
path: root/src/state/timing.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/state/timing.rs')
-rw-r--r--src/state/timing.rs10
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(