Skip to main content

ReliableDataOutputChannel

Struct ReliableDataOutputChannel 

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

Converts application data into ordered, fragmented reliable data packets.

Implementations§

Source§

impl ReliableDataOutputChannel

Source

pub fn new( config: OutputConfig, cipher: Option<Rc4KeyState>, _now: Instant, ) -> Self

Creates a new output channel. cipher is the initial RC4 key state; pass Some(..) to enable RC4 encryption of the proxied application data, or None to pass it through unencrypted.

Source

pub fn stats(&self) -> &DataOutputStats

Returns the gathered output statistics.

Source

pub fn take_outgoing(&mut self) -> Vec<OutgoingReliable>

Drains the outgoing reliable data packets accumulated so far.

Source

pub fn queued_len(&self) -> usize

Returns the number of reliable data packets currently awaiting acknowledgement.

Source

pub fn set_max_data_length(&mut self, max_data_length: usize)

Sets the maximum length of the data portion (sequence + data) of a single packet. Should not be called after data has been enqueued.

Source

pub fn enqueue_data(&mut self, data: &[u8])

Enqueues application data to be sent on the reliable channel. The data is fragmented as required to fit within the configured maximum packet length.

Source

pub fn run_tick(&mut self, now: Instant)

Runs a tick of the output channel, moving due packets into the outgoing buffer. If the oldest in-flight packet has gone unacknowledged for longer than the current (adaptive) retransmit timeout, dispatch restarts from the front of the window (go-back-N) and the RTO is backed off exponentially (Karn).

Source

pub fn notify_of_acknowledge(&mut self, sequence: u16, now: Instant)

Notifies the channel that the remote has acknowledged a single sequence.

Source

pub fn notify_of_acknowledge_all(&mut self, sequence: u16, now: Instant)

Notifies the channel that the remote has acknowledged all sequences up to and including the given one.

Trait Implementations§

Source§

impl Debug for ReliableDataOutputChannel

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, 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.