Skip to main content

Sender

Struct Sender 

Source
pub struct Sender { /* private fields */ }
Expand description

ARQ sender-side state (draft-sharabayko-srt-01 §4.8). See the module doc for the sans-IO contract.

Implementations§

Source§

impl Sender

Source

pub fn new(dest_socket_id: u32) -> Self

A fresh sender addressing dest_socket_id (the peer’s SRT Socket ID, carried in every packet header, §3).

Source

pub fn rtt(&self) -> Duration

The current RTT estimate (rule 33 — updated from each Full ACK’s carried value).

Source

pub fn rtt_var(&self) -> Duration

The current RTTVar estimate.

Source

pub fn buffered_count(&self) -> usize

Number of packets still buffered, unacknowledged.

Source

pub fn pending_retransmit_count(&self) -> usize

Number of sequence numbers currently pending retransmission.

Source

pub fn on_data( &mut self, seq: u32, message_number: u32, payload: &[u8], now: Duration, ) -> Vec<u8>

Submit a new data packet for first transmission (rule 1: the sender buffers every sent packet to enable retransmission). Returns the wire bytes to send now — see the module doc’s priority note.

Source

pub fn on_nak(&mut self, nak: &NakPacket<'_>)

Record a NAK’s loss-list entries for prioritized retransmission (specs/rules/srt-arq.md rules 5, 15, 16, 18). Entries no longer in the send buffer (already freed by a since-received ACK) are silently ignored (rule 17).

Source

pub fn tick(&mut self, now: Duration) -> Vec<Vec<u8>>

Drain the pending retransmit queue, returning the wire bytes of each retransmission (rules 16, 18 — the R flag is set, the resend counter incremented). A queued sequence number no longer in the buffer (freed by a since-received ACK) is dropped without emitting anything (rule 17).

Source

pub fn on_ack(&mut self, ack: &AckPacket, now: Duration) -> Option<Vec<u8>>

Process an incoming ACK: free every acknowledged packet (rules 7, 8, 16, 17), and — for a Full ACK only — update RTT/RTTVar (rule 33) and return the ACKACK reply (rules 3, 9).

Trait Implementations§

Source§

impl Debug for Sender

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.