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
impl Sender
Sourcepub fn new(dest_socket_id: u32) -> Self
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).
Sourcepub fn rtt(&self) -> Duration
pub fn rtt(&self) -> Duration
The current RTT estimate (rule 33 — updated from each Full ACK’s carried value).
Sourcepub fn buffered_count(&self) -> usize
pub fn buffered_count(&self) -> usize
Number of packets still buffered, unacknowledged.
Sourcepub fn pending_retransmit_count(&self) -> usize
pub fn pending_retransmit_count(&self) -> usize
Number of sequence numbers currently pending retransmission.
Sourcepub fn on_data(
&mut self,
seq: u32,
message_number: u32,
payload: &[u8],
now: Duration,
) -> Vec<u8> ⓘ
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.
Sourcepub fn on_nak(&mut self, nak: &NakPacket<'_>)
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).
Sourcepub fn tick(&mut self, now: Duration) -> Vec<Vec<u8>>
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).