pub struct RttEstimator { /* private fields */ }Available on crate feature
transport only.Expand description
RTT estimator implementing RFC 6298.
This struct maintains smoothed RTT (SRTT) and RTT variance (RTTVAR) values, and computes an adaptive Retransmission Timeout (RTO).
Implementations§
Source§impl RttEstimator
impl RttEstimator
Sourcepub fn update(&mut self, sample: Duration)
pub fn update(&mut self, sample: Duration)
Update RTT estimate with a new sample.
Implements RFC 6298 RTT calculation:
- First measurement: SRTT = sample, RTTVAR = sample / 2
- Subsequent: RTTVAR = 0.75 * RTTVAR + 0.25 * |SRTT - sample|
- SRTT = 0.875 * SRTT + 0.125 * sample
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if the estimator has been initialized with at least one sample.
Sourcepub fn backoff(&mut self) -> Duration
pub fn backoff(&mut self) -> Duration
Apply exponential backoff to RTO (used after timeout).
Returns the new RTO after doubling (capped at MAX_RTO).
Sourcepub fn reset_backoff(&mut self)
pub fn reset_backoff(&mut self)
Reset RTO to initial value (e.g., after successful transmission).
Trait Implementations§
Source§impl Clone for RttEstimator
impl Clone for RttEstimator
Source§fn clone(&self) -> RttEstimator
fn clone(&self) -> RttEstimator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RttEstimator
impl Debug for RttEstimator
Auto Trait Implementations§
impl Freeze for RttEstimator
impl RefUnwindSafe for RttEstimator
impl Send for RttEstimator
impl Sync for RttEstimator
impl Unpin for RttEstimator
impl UnwindSafe for RttEstimator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more