pub struct SessionPool { /* private fields */ }
Expand description
A data structure that is responsible for holding sessions, and pooling sockets between them. This means that we only provide new unique sockets to new connections to the same gameserver, and we share sockets across multiple gameservers.
Traffic from different gameservers is then demuxed using their address to send back to the original client.
Implementations§
Source§impl SessionPool
impl SessionPool
Sourcepub fn new(
config: Arc<Config>,
downstream_sends: Vec<PacketQueueSender>,
buffer_pool: Arc<BufferPool>,
) -> Arc<Self>
pub fn new( config: Arc<Config>, downstream_sends: Vec<PacketQueueSender>, buffer_pool: Arc<BufferPool>, ) -> Arc<Self>
Constructs a new session pool, it’s created with an Arc
as that’s
required for the pool to provide a reference to the children to be able
to release their sockets back to the parent.
Sourcepub fn send(
self: &Arc<Self>,
key: SessionKey,
packet: FrozenPoolBuffer,
) -> Result<(), PipelineError>
pub fn send( self: &Arc<Self>, key: SessionKey, packet: FrozenPoolBuffer, ) -> Result<(), PipelineError>
Sends packet data to the appropiate session based on its key
.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SessionPool
impl !RefUnwindSafe for SessionPool
impl Send for SessionPool
impl Sync for SessionPool
impl Unpin for SessionPool
impl !UnwindSafe for SessionPool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request