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>
impl<A: RemoteAddr> SoeMultiplexer<A>
Sourcepub fn new(config: SocketConfig) -> Self
pub fn new(config: SocketConfig) -> Self
Creates a new, empty multiplexer.
Sourcepub fn session_count(&self) -> usize
pub fn session_count(&self) -> usize
Returns the number of active sessions.
Sourcepub fn session(&self, remote: &A) -> Option<&SoeSession>
pub fn session(&self, remote: &A) -> Option<&SoeSession>
Returns a reference to the session for remote, if one exists.
Sourcepub fn take_outgoing(&mut self) -> Vec<(A, Bytes)>
pub fn take_outgoing(&mut self) -> Vec<(A, Bytes)>
Drains datagrams to be sent, each tagged with its destination address.
Sourcepub fn take_events(&mut self) -> Vec<SocketEvent<A>>
pub fn take_events(&mut self) -> Vec<SocketEvent<A>>
Drains accumulated session events.
Sourcepub fn connect(&mut self, remote: A, now: Instant)
pub fn connect(&mut self, remote: A, now: Instant)
Opens a client session to remote and sends the initial session request.
Sourcepub fn enqueue_data(&mut self, remote: &A, data: &[u8]) -> bool
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.
Sourcepub fn terminate(&mut self, remote: &A, reason: DisconnectReason, now: Instant)
pub fn terminate(&mut self, remote: &A, reason: DisconnectReason, now: Instant)
Terminates the session with remote, notifying the remote party.
Sourcepub fn process_incoming(&mut self, remote: A, datagram: Bytes, now: Instant)
pub fn process_incoming(&mut self, remote: A, datagram: Bytes, now: Instant)
Processes a single datagram received from remote.
Sourcepub fn run_tick(&mut self, now: Instant)
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).
Sourcepub fn drive<T>(&mut self, transport: &mut T, now: Instant) -> Result<()>where
T: UdpTransport<Addr = A>,
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.