pub struct ReconnectPolicy {
pub initial_delay: Duration,
pub max_delay: Duration,
pub multiplier: u32,
pub jitter: bool,
}Expand description
Bounded exponential backoff between reconnect attempts. The delay doubles (by
multiplier) after each attempt that didn’t produce a working connection, capped at
max_delay - but the number of attempts itself is unbounded: a charge point should keep
trying to reach its CSMS indefinitely rather than giving up after N tries.
The backoff resets as soon as a connection carries any inbound traffic, so an ordinary
transient drop costs one initial_delay rather than an escalating one. Escalation is
reserved for connections that never work - notably a peer that accepts and then immediately
closes, which is indistinguishable from a successful dial until nothing arrives on it.
Fields§
§initial_delay: Duration§max_delay: Duration§multiplier: u32§jitter: boolRandomize each delay within [delay / 2, delay] (“equal jitter”). Defaults to true.
Without it, every charge point that lost the same CSMS retries in lockstep, so the endpoint coming back gets the whole fleet at once, repeatedly. Jitter spreads that out. Half the delay is kept un-jittered so a randomly tiny value can’t defeat the rate bound the backoff exists to provide.
Set false when exact retry timing matters more than fleet behavior - a deterministic
test, mostly.
Trait Implementations§
Source§impl Clone for ReconnectPolicy
impl Clone for ReconnectPolicy
Source§fn clone(&self) -> ReconnectPolicy
fn clone(&self) -> ReconnectPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more