pub(super) struct PacketProcessor {
queued: PacketQueue<PlayerPacketLaneKey, PendingPlayPacket>,
}Expand description
Gameplay packets submitted by network tasks.
The processor runs while the game tick is idle. At each tick boundary it drains every packet submitted before that boundary, while retaining later submissions for the next packet phase. A player-replacement transition temporarily withdraws that session’s queued packets from the runnable global order and re-admits them in session FIFO order after the replacement is bound.
Fields§
§queued: PacketQueue<PlayerPacketLaneKey, PendingPlayPacket>Implementations§
Source§impl PacketProcessor
impl PacketProcessor
pub(super) fn new() -> Self
pub(super) fn schedule( &self, player: Arc<Player>, packet: ScheduledPlayPacket, payload_bytes: usize, )
Sourcepub(super) fn run(&self, server: &Arc<Server>)
pub(super) fn run(&self, server: &Arc<Server>)
Runs the blocking packet worker until the processor is stopped.
Sourcepub(super) fn pause_player_session(
&self,
session: &PlayerSession,
) -> Option<PlayerPacketTransition>
pub(super) fn pause_player_session( &self, session: &PlayerSession, ) -> Option<PlayerPacketTransition>
Suspends one connection’s FIFO lane while its player entity is replaced.
Sourcepub(super) fn resume_player_session(
&self,
transition: PlayerPacketTransition,
) -> bool
pub(super) fn resume_player_session( &self, transition: PlayerPacketTransition, ) -> bool
Re-admits packets retained during player replacement into the runnable global order.
Sourcepub(super) fn discard_player_session(&self, session: &PlayerSession)
pub(super) fn discard_player_session(&self, session: &PlayerSession)
Drops all retained packets for a connection that can no longer own a player.
fn packet_is_runnable( player: &Player, packet: &ScheduledPlayPacket, server_cancelled: bool, ) -> bool
Sourcepub(super) fn open_after_tick(&self)
pub(super) fn open_after_tick(&self)
Opens the inter-tick packet phase and wakes the worker.
Sourcepub(super) async fn wait_for_overload_progress(&self)
pub(super) async fn wait_for_overload_progress(&self)
Guarantees packet progress when a late tick leaves no normal inter-tick window.
Sourcepub(super) async fn close_for_tick(&self)
pub(super) async fn close_for_tick(&self)
Drains packets submitted before this tick boundary, then closes packet admission.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PacketProcessor
impl !RefUnwindSafe for PacketProcessor
impl !UnwindSafe for PacketProcessor
impl Send for PacketProcessor
impl Sync for PacketProcessor
impl Unpin for PacketProcessor
impl UnsafeUnpin for PacketProcessor
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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 moreArc<SyncMutex<>>