SessionManager

Struct SessionManager 

Source
pub struct SessionManager<TSocket: TransportSocket, TSession: Session> { /* private fields */ }
Expand description

Session manager over a datagram socket and generic Session engine.

Implementations§

Source§

impl<TSocket: TransportSocket, TSession: Session> SessionManager<TSocket, TSession>

Source

pub fn new(socket: TSocket, config: Config) -> Self

Creates a new session manager.

Source

pub fn new_with_interceptor( socket: TSocket, config: Config, interceptor: Option<Box<dyn Interceptor>>, ) -> Self

Creates a new session manager with a custom interceptor.

Source

pub fn manual_poll(&mut self, time: Instant)

Polls for network I/O and processes all sessions.

Source

pub fn event_sender(&self) -> &Sender<TSession::SendEvent>

Returns the event sender for sending user events to sessions.

Source

pub fn event_receiver(&self) -> &Receiver<TSession::ReceiveEvent>

Returns the event receiver for receiving session events.

Source

pub fn socket(&self) -> &TSocket

Returns a reference to the underlying socket.

Source

pub fn socket_mut(&mut self) -> &mut TSocket

Returns a mutable reference to the underlying socket.

Source

pub fn sessions_count(&self) -> usize

Returns the number of active sessions.

Source

pub fn session_mut(&mut self, addr: &SocketAddr) -> Option<&mut TSession>

Returns a mutable reference to a specific session by address.

Source

pub fn established_sessions(&self) -> impl Iterator<Item = &SocketAddr>

Returns an iterator over all established session addresses.

Source

pub fn established_sessions_count(&self) -> usize

Returns the number of established sessions.

Source

pub fn duplicate_peer_count(&self, addr: &SocketAddr) -> usize

Returns the number of connections from a specific IP address.

Trait Implementations§

Source§

impl<TSocket: Debug + TransportSocket, TSession: Debug + Session> Debug for SessionManager<TSocket, TSession>
where TSession::SendEvent: Debug, TSession::ReceiveEvent: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<TSocket, TSession> Freeze for SessionManager<TSocket, TSession>
where TSocket: Freeze,

§

impl<TSocket, TSession> !RefUnwindSafe for SessionManager<TSocket, TSession>

§

impl<TSocket, TSession> Send for SessionManager<TSocket, TSession>
where <TSession as Session>::SendEvent: Send, TSocket: Send, <TSession as Session>::ReceiveEvent: Send, TSession: Send,

§

impl<TSocket, TSession> !Sync for SessionManager<TSocket, TSession>

§

impl<TSocket, TSession> Unpin for SessionManager<TSocket, TSession>
where TSocket: Unpin, <TSession as Session>::SendEvent: Unpin, <TSession as Session>::ReceiveEvent: Unpin, TSession: Unpin,

§

impl<TSocket, TSession> !UnwindSafe for SessionManager<TSocket, TSession>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more