aboutsummaryrefslogtreecommitdiffstats
path: root/src/state/timing.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-22 15:41:08 +0000
committertv <tv@krebsco.de>2026-11-22 15:41:14 +0000
commit1063c8ef8da08f76bdc75823a4c16924b55b0e8e (patch)
treea195ab9b38ddb4933cdad6cbb42ae742aaa1e86d /src/state/timing.rs
parent448089f452025ec8c655532c758ea6ca9520b6ae (diff)
hyparview: its timers from Timing, derived from the keepalive
ASK_FOR (20 s), REFUSED_FOR (60 s), ONE_SHORT_EVERY (300 s) and REAFFIRM_EVERY (60 s) were fixed: the simulations, on a 250 ms keepalive, sat them out in real time, and simtest::hyparview's two took a minute each, most of cargo sim's. Now Timing has them (ask_for, refused_for, one_short_every, reaffirm_every): twice the first sync reply timeout, one keepalive interval, five, and one. At the defaults (1m, 10 s) they are what they were; with another --keepalive they scale with it, as the keepalives they answer to do. The two simulations take 3 s.
Diffstat (limited to 'src/state/timing.rs')
-rw-r--r--src/state/timing.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/state/timing.rs b/src/state/timing.rs
index fed48e9..adb8cfe 100644
--- a/src/state/timing.rs
+++ b/src/state/timing.rs
@@ -44,6 +44,25 @@ pub(crate) struct Timing {
/// (`Transport::delivery_limit`): a peer silent for longer has nothing on the way to
/// us any more.
pub(crate) delivery_limit: Duration,
+ /// HyParView (`swarm::hyparview`): how long a member asked to be a neighbour has to
+ /// agree, the handshake before included. Twice the first sync reply timeout: over
+ /// Tor, a few round trips of up to 3 s.
+ pub(crate) ask_for: Duration,
+ /// HyParView: a member that refused, didn't answer, or left isn't asked again for this
+ /// long. A keepalive interval.
+ pub(crate) refused_for: Duration,
+ /// HyParView: a member one neighbour short asks this seldom (five keepalive
+ /// intervals): in a swarm whose members mostly have `k`, asking each in turn kept
+ /// NEIGHBOURs going in a quiet swarm (up to 300 in 20 s at 50 members). Two or more
+ /// short, it asks at once. A member with `k` takes it (it says it is one short), so one
+ /// ask is enough but where those asked have `k + 1`.
+ pub(crate) one_short_every: Duration,
+ /// HyParView: each neighbour is asked again this often whether it still is (NEIGHBOUR,
+ /// as a new ask would be), a keepalive interval: a NEIGHBOUR_REPLY or DISCONNECT lost
+ /// on a lossy link leaves a link in one end's view only, and nothing else would tell
+ /// that end: the other still answers it. A neighbour that has us agrees at once; one
+ /// that doesn't takes us if it has room, else refuses, and we drop it.
+ pub(crate) reaffirm_every: Duration,
}
impl Timing {
@@ -100,6 +119,10 @@ impl Timing {
sync_reply_timeout,
unreached_after: sync_reply_timeout * 2,
delivery_limit,
+ ask_for: sync_reply_timeout * 2,
+ refused_for: keepalive,
+ one_short_every: keepalive * 5,
+ reaffirm_every: keepalive,
}
}