pub struct SoeSession { /* private fields */ }Expand description
an I/O-agnostic handler for a single SOE protocol session.
Implementations§
Source§impl SoeSession
impl SoeSession
Sourcepub fn new(
mode: SessionMode,
params: SessionParameters,
app: ApplicationParameters,
rng_seed: u64,
now: Instant,
) -> Self
pub fn new( mode: SessionMode, params: SessionParameters, app: ApplicationParameters, rng_seed: u64, now: Instant, ) -> Self
Creates a new session handler in the SessionState::Negotiating state.
rng_seed seeds the generator used for the session ID (client) and CRC seed
(server); pass a fixed value for deterministic behaviour, or entropy for real
sessions.
Sourcepub fn state(&self) -> SessionState
pub fn state(&self) -> SessionState
Returns the current session state.
Sourcepub fn mode(&self) -> SessionMode
pub fn mode(&self) -> SessionMode
Returns the session mode.
Sourcepub fn session_id(&self) -> u32
pub fn session_id(&self) -> u32
Returns the negotiated session ID.
Sourcepub fn termination_reason(&self) -> DisconnectReason
pub fn termination_reason(&self) -> DisconnectReason
Returns the reason the session terminated (meaningful once terminated).
Sourcepub fn terminated_by_remote(&self) -> bool
pub fn terminated_by_remote(&self) -> bool
Returns whether the termination was initiated by the remote party.
Sourcepub fn take_outgoing(&mut self) -> Vec<Bytes>
pub fn take_outgoing(&mut self) -> Vec<Bytes>
Drains datagrams that the caller should send to the remote.
Sourcepub fn take_received(&mut self) -> Vec<Bytes>
pub fn take_received(&mut self) -> Vec<Bytes>
Drains application data received from the remote.
Sourcepub fn take_events(&mut self) -> Vec<SessionEvent>
pub fn take_events(&mut self) -> Vec<SessionEvent>
Drains session lifecycle events.
Sourcepub fn send_session_request(&mut self)
pub fn send_session_request(&mut self)
Sends a SessionRequest to begin negotiation. Only valid in client mode
while negotiating.
Sourcepub fn enqueue_data(&mut self, data: &[u8]) -> bool
pub fn enqueue_data(&mut self, data: &[u8]) -> bool
Enqueues application data to be sent reliably. Returns false if the session
is not running.
Sourcepub fn terminate(
&mut self,
reason: DisconnectReason,
notify_remote: bool,
now: Instant,
)
pub fn terminate( &mut self, reason: DisconnectReason, notify_remote: bool, now: Instant, )
Terminates the session, optionally notifying the remote.
Sourcepub fn process_incoming(&mut self, datagram: Bytes, now: Instant)
pub fn process_incoming(&mut self, datagram: Bytes, now: Instant)
Processes a single incoming datagram from the remote.