pub struct Bbr { /* private fields */ }Expand description
BBR sender-side state.
Implementations§
Source§impl Bbr
impl Bbr
pub fn new(now: Instant, packet_bytes: u64) -> Self
Sourcepub fn on_send(&mut self, now: Instant, app_limited: bool) -> PacketSample
pub fn on_send(&mut self, now: Instant, app_limited: bool) -> PacketSample
Snapshot the rate-sample state for a packet about to be sent. The
caller stores the returned PacketSample with the packet and
returns it on delivery via on_ack.
Sourcepub fn on_ack(&mut self, now: Instant, samples: &[PacketSample])
pub fn on_ack(&mut self, now: Instant, samples: &[PacketSample])
Process an ACK delivering samples (the snapshots of every packet
newly known-received on this ACK, both the cumulative-ACK advance
and any newly SACKed ids). The RTT is taken from the most recently
sent acked packet, per the spec; picking that packet by its delivered
snapshot also makes the rate sample robust to retransmits (a resent
symbol keeps its old, low delivered, so it is never picked).
Sourcepub fn pacing_rate_bps(&self) -> f64
pub fn pacing_rate_bps(&self) -> f64
Target pacing rate in bytes/second: pacing_gain * BtlBw, minus the
1% margin. Zero until the first reliable bandwidth sample lands
(the caller should then fall back to its own flow control).
Sourcepub fn cwnd_bytes(&self) -> u64
pub fn cwnd_bytes(&self) -> u64
Target congestion window in bytes: cwnd_gain * BDP, floored at
MIN_PIPE_CWND and reduced to PROBE_RTT_CWND during ProbeRTT.
Sourcepub fn has_estimate(&self) -> bool
pub fn has_estimate(&self) -> bool
Whether a usable bandwidth estimate exists yet.