pub trait CongestionController: 'static + Clone + Send + Debug {
    fn congestion_window(&self) -> u32;
fn bytes_in_flight(&self) -> u32;
fn is_congestion_limited(&self) -> bool;
fn requires_fast_retransmission(&self) -> bool;
fn on_packet_sent(
        &mut self,
        time_sent: Timestamp,
        sent_bytes: usize,
        rtt_estimator: &RttEstimator
    );
fn on_rtt_update(
        &mut self,
        time_sent: Timestamp,
        rtt_estimator: &RttEstimator
    );
fn on_packet_ack(
        &mut self,
        largest_acked_time_sent: Timestamp,
        bytes_sent: usize,
        rtt_estimator: &RttEstimator,
        ack_receive_time: Timestamp
    );
fn on_packets_lost(
        &mut self,
        lost_bytes: u32,
        persistent_congestion: bool,
        timestamp: Timestamp
    );
fn on_congestion_event(&mut self, event_time: Timestamp);
fn on_mtu_update(&mut self, max_data_size: u16);
fn on_packet_discarded(&mut self, bytes_sent: usize);
fn earliest_departure_time(&self) -> Option<Timestamp>; }

Required methods

Returns the size of the current congestion window in bytes

Returns the current bytes in flight

Returns true if the congestion window does not have sufficient space for a packet of max_datagram_size considering the current bytes in flight

Returns true if the current state of the congestion controller requires a packet to be transmitted without respecting the available congestion window

Invoked whenever a congestion controlled packet is sent

Invoked each time the round trip time is updated, which is whenever the largest acknowledged packet in an ACK frame is newly acknowledged

Invoked for each newly acknowledged packet

Invoked when packets are declared lost

Invoked from on_packets_lost, but is also directly invoked when the Explicit Congestion Notification counter increases.

Invoked when the path maximum transmission unit is updated.

Invoked for each packet discarded when a packet number space is discarded.

Returns the earliest time that a packet may be transmitted.

If the time is in the past or is None, the packet should be transmitted immediately.

Implementors