From 1063c8ef8da08f76bdc75823a4c16924b55b0e8e Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 22 Nov 2026 15:41:08 +0000 Subject: 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. --- src/state/timing.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/state/timing.rs') 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, } } -- cgit v1.3.1