Skip to main content

SoeSession

Struct SoeSession 

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

an I/O-agnostic handler for a single SOE protocol session.

Implementations§

Source§

impl SoeSession

Source

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.

Source

pub fn state(&self) -> SessionState

Returns the current session state.

Source

pub fn mode(&self) -> SessionMode

Returns the session mode.

Source

pub fn session_id(&self) -> u32

Returns the negotiated session ID.

Source

pub fn crc_seed(&self) -> u32

Returns the negotiated CRC seed (meaningful once running).

Source

pub fn termination_reason(&self) -> DisconnectReason

Returns the reason the session terminated (meaningful once terminated).

Source

pub fn terminated_by_remote(&self) -> bool

Returns whether the termination was initiated by the remote party.

Source

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

Drains datagrams that the caller should send to the remote.

Source

pub fn take_received(&mut self) -> Vec<Bytes>

Drains application data received from the remote.

Source

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

Drains session lifecycle events.

Source

pub fn send_session_request(&mut self)

Sends a SessionRequest to begin negotiation. Only valid in client mode while negotiating.

Source

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

Enqueues application data to be sent reliably. Returns false if the session is not running.

Source

pub fn terminate( &mut self, reason: DisconnectReason, notify_remote: bool, now: Instant, )

Terminates the session, optionally notifying the remote.

Source

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

Processes a single incoming datagram from the remote.

Source

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

Runs a single tick of the session: heartbeats, inactivity timeout, and the reliable data channels.

Trait Implementations§

Source§

impl Debug for SoeSession

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.