pub struct RetransmissionState { /* private fields */ }Expand description
Stores the current (re)transmission state for the current message and implements the exponential backoff strategy for retransmissions
Implementations§
Source§impl RetransmissionState
impl RetransmissionState
Sourcepub fn new(transmission_parameters: TransmissionParameters, random: f32) -> Self
pub fn new(transmission_parameters: TransmissionParameters, random: f32) -> Self
Initializes this RetransmissionState with retransmission_counter set to None. This
assumes that the state is initialized from one of the schedule_ methods which can not
actually transmit anything but only trigger an internal state change which requires that
the first message is sent in the next process_ invocation.
random must be a random value between 0 and 1.
Sourcepub fn retransmit_required(
&mut self,
now: Instant,
) -> Result<bool, RetransmissionTimeout>
pub fn retransmit_required( &mut self, now: Instant, ) -> Result<bool, RetransmissionTimeout>
Returns if a retransmission is required, we should keep waiting or if the whole transmission has timed out. Returns:
Some(true)if a retransmission should happenSome(false)if we should keep waitingErr(Error::Timeout)if the transmission (with retransmissions) has timed out
If a retransmission is required, this will increase the internal retransmission timer so this assumes that the retransmission will be triggered.
Trait Implementations§
Source§impl Clone for RetransmissionState
impl Clone for RetransmissionState
Source§fn clone(&self) -> RetransmissionState
fn clone(&self) -> RetransmissionState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more