pub trait CongestionController: Send + Sync {
// Required methods
fn on_ack(&mut self, bytes_acked: u32, rtt_us: u64);
fn on_duplicate_ack(&mut self);
fn on_timeout(&mut self);
fn congestion_window(&self) -> u32;
fn slow_start_threshold(&self) -> u32;
}Expand description
Congestion controller trait
Provides a pluggable interface for congestion control algorithms.
The default implementation is TCP Reno (RenoController).
Required Methods§
Sourcefn on_ack(&mut self, bytes_acked: u32, rtt_us: u64)
fn on_ack(&mut self, bytes_acked: u32, rtt_us: u64)
Called when new data is acknowledged.
bytes_acked: number of newly acknowledged bytes
rtt_us: measured round-trip time in microseconds (0 if unavailable)
Sourcefn on_duplicate_ack(&mut self)
fn on_duplicate_ack(&mut self)
Called when a duplicate ACK is received.
Sourcefn on_timeout(&mut self)
fn on_timeout(&mut self)
Called when a retransmission timeout fires.
Sourcefn congestion_window(&self) -> u32
fn congestion_window(&self) -> u32
Returns the current congestion window in bytes.
Sourcefn slow_start_threshold(&self) -> u32
fn slow_start_threshold(&self) -> u32
Returns the current slow-start threshold in bytes.