From 08d2da02cfb305bbe4b965340db48129e22f60f4 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 05:27:08 +0100 Subject: move DELIVERY_LIMIT to sim transport --- src/simtest/mod.rs | 5 +---- src/transport/sim.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/simtest/mod.rs b/src/simtest/mod.rs index 3c73bee..f191946 100644 --- a/src/simtest/mod.rs +++ b/src/simtest/mod.rs @@ -33,7 +33,7 @@ use crate::node::{self, Node, NodeConfig}; use crate::state::{AppState, PeerState, Timing}; use crate::swarm::bootstrap::{self, Start}; use crate::transport::identity::IdentityConfig; -use crate::transport::sim::SimNet; +use crate::transport::sim::{DELIVERY_LIMIT, SimNet}; /// Keepalive of simulated nodes: dormancy after 1 s, probes of dormant peers every /// 2.5 s (`Timing::new`). @@ -41,9 +41,6 @@ pub(crate) const KEEPALIVE: Duration = Duration::from_millis(250); /// First wait for a sync answer before sending again (10 s in production, where large /// messages take a while): a lost sync message costs a test 1 s, a heal 2 s. pub(crate) const SYNC_REPLY_TIMEOUT: Duration = Duration::from_secs(1); -/// How long the simulated net may take to deliver a message: well above its delays. -/// A catch-up source that stops sending sync messages is given up after this. -pub(crate) const DELIVERY_LIMIT: Duration = Duration::from_secs(3); /// How long tests wait for what should happen within a few keepalives: joining, /// registering, converging. pub(crate) const SOON: Duration = Duration::from_secs(10); diff --git a/src/transport/sim.rs b/src/transport/sim.rs index f4a48aa..e783743 100644 --- a/src/transport/sim.rs +++ b/src/transport/sim.rs @@ -29,6 +29,10 @@ use super::{EncodedMessage, MessageHandler, MessageKind, ParsedMessage, Transpor use crate::locks::MutexExt; use crate::testrand::Rng; +/// How long the simulated net may take to deliver a message: well above its delays. +/// A catch-up source that stops sending sync messages is given up after this. +pub(crate) const DELIVERY_LIMIT: Duration = Duration::from_secs(3); + /// How one direction of a link behaves. #[derive(Clone, Debug)] pub(crate) struct LinkParams { @@ -291,8 +295,8 @@ impl Transport for SimTransport { !id.is_empty() } - fn delivery_limit(&self) -> std::time::Duration { - crate::simtest::DELIVERY_LIMIT + fn delivery_limit(&self) -> Duration { + DELIVERY_LIMIT } /// A seed is a node ID; one no node has doesn't resolve (yet). -- cgit v1.3.1