pub struct ReconnectionConfig {
pub base_delay: Duration,
pub max_delay: Duration,
pub max_attempts: u32,
pub check_interval: Duration,
pub use_flat_delay: bool,
pub reset_on_exhaustion: bool,
}Expand description
Configuration for reconnection behavior
Fields§
§base_delay: DurationBase delay between reconnection attempts (default: 2 seconds)
max_delay: DurationMaximum delay between attempts (default: 60 seconds)
max_attempts: u32Maximum number of reconnection attempts before giving up (default: 10)
check_interval: DurationInterval for checking which peers need reconnection (default: 5 seconds)
use_flat_delay: boolUse flat delay instead of exponential backoff (default: false)
When true, every attempt uses base_delay with no exponential increase.
reset_on_exhaustion: boolAuto-reset attempt counter when max_attempts is exhausted (default: false) When true, reaching max_attempts resets the counter instead of abandoning the peer.
Implementations§
Source§impl ReconnectionConfig
impl ReconnectionConfig
Sourcepub fn new(
base_delay: Duration,
max_delay: Duration,
max_attempts: u32,
check_interval: Duration,
) -> Self
pub fn new( base_delay: Duration, max_delay: Duration, max_attempts: u32, check_interval: Duration, ) -> Self
Create a new configuration with custom values
Sourcepub fn conservative() -> Self
pub fn conservative() -> Self
Create a conservative config for battery-constrained devices
Sourcepub fn kotlin_normal() -> Self
pub fn kotlin_normal() -> Self
Kotlin Android normal mode: base=1s, max=15s, 20 attempts, exponential backoff
Sourcepub fn kotlin_high_priority() -> Self
pub fn kotlin_high_priority() -> Self
Kotlin Android high-priority mode: base=1s, flat delay, auto-reset on exhaustion
Trait Implementations§
Source§impl Clone for ReconnectionConfig
impl Clone for ReconnectionConfig
Source§fn clone(&self) -> ReconnectionConfig
fn clone(&self) -> ReconnectionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more