Skip to main content

Receiver

Struct Receiver 

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

ARQ receiver-side state (draft-sharabayko-srt-01 §4.8.1/§4.8.2/§4.10).

Implementations§

Source§

impl Receiver

Source

pub fn new(dest_socket_id: u32, initial_seq: u32, max_flow_window: u32) -> Self

A fresh receiver expecting initial_seq first (the peer’s ISN), addressing dest_socket_id (the peer’s SRT Socket ID, §3), advertising max_flow_window (§3.2.1) as its Full ACK’s Available Buffer Size.

Source

pub fn with_mtu(self, mtu: u32) -> Self

Size periodic NAK datagrams against mtu (the handshake’s negotiated Maximum Transmission Unit Size, §3.2.1) instead of the 1500-byte default: a loss list too long for one datagram is split across several NAK packets rather than emitted as one the socket cannot send.

Source

pub fn ack_point(&self) -> u32

The cumulative ack point — every seq strictly before this has been delivered in order (rule 8’s ACK n + 1 semantics).

Source

pub fn rtt(&self) -> Duration

The current RTT estimate (rules 26-31).

Source

pub fn rtt_var(&self) -> Duration

The current RTTVar estimate.

Source

pub fn loss_list_len(&self) -> usize

Number of sequence numbers currently believed lost.

Source

pub fn feed_data(&mut self, seq_number: u32, now: Duration) -> FeedOutcome

Process one arriving data packet’s sequence number.

A packet more than the flow window ahead of the ack point is ignored (FeedOutcome::out_of_window): a crafted sequence jump therefore never grows the loss list or the out-of-order set past the window.

Source

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

Advance to absolute time now and emit any periodic control packets now due: a Full ACK every super::FULL_ACK_PERIOD (rule 11), a Light ACK once super::LIGHT_ACK_THRESHOLD packets have arrived since the last ACK (rule 12), and a periodic NAK once NAKInterval has elapsed and the loss list is non-empty (rules 21, 22) — never a NAK when nothing is believed lost.

Source

pub fn next_timeout(&self) -> Duration

Absolute (since the connection epoch) time of the next periodic Full ACK or, while the loss list is non-empty, the next periodic NAK — whichever is earlier. Always defined: the 10 ms Full ACK is unconditional (rule 11), so an idle connection still has a deadline.

Source

pub fn on_ackack(&mut self, ackack: &AckAckPacket, now: Duration)

Process an incoming ACKACK: match it against the outstanding Full ACK it acknowledges and update RTT/RTTVar from the round-trip sample (rules 26-30). An ACKACK for an unknown/already-matched Acknowledgement Number is ignored.

Trait Implementations§

Source§

impl Debug for Receiver

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.