expression
Reset reconnect backoff after a stable session
Do not reset a reconnect delay merely because a socket briefly opened. A policy may require a completed application handshake and a stable interval. The fixed boolean input represents that decision; it does not measure live session health. Expected stdout (not executed): 200 400 100 200 Common mistake: Treating a successful TCP connection as proof of sustained application health.
Formal Syntax & Structure
rust syntaxrust
if stable { base } else { previous.saturating_mul(2).min(cap) }Working Example
Example Snippetrust
fn main() { let base = 100u64; let cap = 800u64; let mut delay = base; for stable in [false, false, true, false] { delay = if stable { base } else { delay.saturating_mul(2).min(cap) }; println!("{delay}"); }}