pub struct CongestionControl { /* private fields */ }Expand description
Congestion control and RTT tracking with dynamic throttle.
Implementations§
Source§impl CongestionControl
impl CongestionControl
Sourcepub fn enable_advanced_throttling(
&mut self,
scale: u32,
acceleration: u32,
deceleration: u32,
interval_ms: u32,
)
pub fn enable_advanced_throttling( &mut self, scale: u32, acceleration: u32, deceleration: u32, interval_ms: u32, )
Enables advanced throttling with custom parameters.
Sourcepub fn update_rtt(&mut self, sample: Duration)
pub fn update_rtt(&mut self, sample: Duration)
Updates RTT measurement with a new sample. Uses exponential weighted moving average (EWMA).
Sourcepub fn rtt_variance(&self) -> Duration
pub fn rtt_variance(&self) -> Duration
Returns the RTT variance.
Sourcepub fn rto(&self) -> Duration
pub fn rto(&self) -> Duration
Returns the retransmission timeout (RTO) based on RTT. Uses the standard RTO = RTT + 4 * variance formula.
Sourcepub fn record_loss(&mut self)
pub fn record_loss(&mut self)
Records a packet loss event.
Sourcepub fn record_sent(&mut self)
pub fn record_sent(&mut self)
Records a packet send event.
Sourcepub fn update_throttle(&mut self, now: Instant) -> bool
pub fn update_throttle(&mut self, now: Instant) -> bool
Updates the dynamic throttle based on current network conditions. Returns true if throttle was updated.
Sourcepub fn should_drop_unreliable(&self) -> bool
pub fn should_drop_unreliable(&self) -> bool
Returns whether an unreliable packet should be dropped based on throttle. Uses throttle as drop probability.
Sourcepub fn packet_throttle(&self) -> u32
pub fn packet_throttle(&self) -> u32
Returns the current packet throttle value (0 to throttle_scale).
Sourcepub fn throttle_scale(&self) -> u32
pub fn throttle_scale(&self) -> u32
Returns the throttle scale.
Sourcepub fn is_advanced_throttling_enabled(&self) -> bool
pub fn is_advanced_throttling_enabled(&self) -> bool
Returns whether advanced throttling is enabled.
Sourcepub fn set_throttle_range(&mut self, min: f32, max: f32)
pub fn set_throttle_range(&mut self, min: f32, max: f32)
Sets the throttle range.
Sourcepub fn configure_throttle(
&mut self,
interval_ms: u32,
acceleration: u32,
deceleration: u32,
)
pub fn configure_throttle( &mut self, interval_ms: u32, acceleration: u32, deceleration: u32, )
Configures throttle parameters dynamically (for ThrottleConfigure command).
Sourcepub fn reset_stats(&mut self)
pub fn reset_stats(&mut self)
Resets all statistics.
Trait Implementations§
Source§impl Clone for CongestionControl
impl Clone for CongestionControl
Source§fn clone(&self) -> CongestionControl
fn clone(&self) -> CongestionControl
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more