Skip to main content

SoeMultiplexer

Struct SoeMultiplexer 

Source
pub struct SoeMultiplexer<A: RemoteAddr> { /* private fields */ }
Expand description

an I/O-agnostic multiplexer of SOE sessions, keyed by remote address.

Implementations§

Source§

impl<A: RemoteAddr> SoeMultiplexer<A>

Source

pub fn new(config: SocketConfig) -> Self

Creates a new, empty multiplexer.

Source

pub fn session_count(&self) -> usize

Returns the number of active sessions.

Source

pub fn session(&self, remote: &A) -> Option<&SoeSession>

Returns a reference to the session for remote, if one exists.

Source

pub fn take_outgoing(&mut self) -> Vec<(A, Bytes)>

Drains datagrams to be sent, each tagged with its destination address.

Source

pub fn take_events(&mut self) -> Vec<SocketEvent<A>>

Drains accumulated session events.

Source

pub fn connect(&mut self, remote: A, now: Instant)

Opens a client session to remote and sends the initial session request.

Source

pub fn enqueue_data(&mut self, remote: &A, data: &[u8]) -> bool

Enqueues application data to be sent reliably to remote. Returns false if there is no running session for that address.

Source

pub fn terminate(&mut self, remote: &A, reason: DisconnectReason, now: Instant)

Terminates the session with remote, notifying the remote party.

Source

pub fn process_incoming(&mut self, remote: A, datagram: Bytes, now: Instant)

Processes a single datagram received from remote.

Source

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

Runs a single tick over every session: heartbeats, timeouts, and the reliable data channels. Terminated sessions are removed (after their final events are surfaced).

Source

pub fn drive<T>(&mut self, transport: &mut T, now: Instant) -> Result<()>
where T: UdpTransport<Addr = A>,

Runs a single read/tick/send step over transport: drains all immediately available datagrams, runs a tick, and flushes outgoing datagrams.

Datagrams larger than 2048 bytes are not supported by this helper; SOE UDP lengths default to 512 and rarely exceed it.

Trait Implementations§

Source§

impl<A: Debug + RemoteAddr> Debug for SoeMultiplexer<A>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<A> Freeze for SoeMultiplexer<A>

§

impl<A> RefUnwindSafe for SoeMultiplexer<A>
where A: RefUnwindSafe,

§

impl<A> Send for SoeMultiplexer<A>
where A: Send,

§

impl<A> Sync for SoeMultiplexer<A>
where A: Sync,

§

impl<A> Unpin for SoeMultiplexer<A>
where A: Unpin,

§

impl<A> UnsafeUnpin for SoeMultiplexer<A>

§

impl<A> UnwindSafe for SoeMultiplexer<A>
where A: UnwindSafe,

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.