pub struct PathMtuState { /* private fields */ }Expand description
Path MTU tracking for a single session.
Destination side: observes path_mtu from incoming SessionDatagram envelopes
and generates PathMtuNotification messages back to the source.
Source side: applies received PathMtuNotification to limit outbound datagram size. Decrease is immediate; increase requires 3 consecutive notifications.
Implementations§
Source§impl PathMtuState
impl PathMtuState
Sourcepub fn current_mtu(&self) -> u16
pub fn current_mtu(&self) -> u16
Current effective path MTU (source-side, for sending).
Sourcepub fn last_observed_mtu(&self) -> u16
pub fn last_observed_mtu(&self) -> u16
Last observed incoming path MTU (destination-side).
Sourcepub fn update_interval_from_srtt(&mut self, srtt_ms: f64)
pub fn update_interval_from_srtt(&mut self, srtt_ms: f64)
Update notification interval from SRTT: max(10s, 5 * SRTT).
Sourcepub fn seed_source_mtu(&mut self, outbound_mtu: u16)
pub fn seed_source_mtu(&mut self, outbound_mtu: u16)
Seed source-side current_mtu from outbound transport MTU.
Called on each send. Only decreases (never increases) the current_mtu so the destination’s PathMtuNotification can still raise it later. Ensures current_mtu doesn’t stay at u16::MAX before any notification arrives from the destination.
Sourcepub fn observe_incoming_mtu(&mut self, path_mtu: u16)
pub fn observe_incoming_mtu(&mut self, path_mtu: u16)
Observe the path_mtu from an incoming SessionDatagram envelope.
Called on the destination (receiver) side for every session message.
Sourcepub fn should_send_notification(&self, now: Instant) -> bool
pub fn should_send_notification(&self, now: Instant) -> bool
Check if a PathMtuNotification should be sent.
Send on first measurement, on decrease (immediate), or periodic confirmation at the notification interval.
Sourcepub fn build_notification(&mut self, now: Instant) -> Option<u16>
pub fn build_notification(&mut self, now: Instant) -> Option<u16>
Build a PathMtuNotification from current state.
Returns the path_mtu value to send. Caller handles encoding.
Sourcepub fn apply_notification(&mut self, reported_mtu: u16, now: Instant) -> bool
pub fn apply_notification(&mut self, reported_mtu: u16, now: Instant) -> bool
Apply a received PathMtuNotification.
- Decrease: immediate (take the lower value).
- Increase: require 3 consecutive notifications with the same higher value, spanning at least 2 * notification_interval.
Returns true if the effective MTU changed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PathMtuState
impl RefUnwindSafe for PathMtuState
impl Send for PathMtuState
impl Sync for PathMtuState
impl Unpin for PathMtuState
impl UnsafeUnpin for PathMtuState
impl UnwindSafe for PathMtuState
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more