pub enum DisconnectBehavior {
Halt,
ContinueWithout,
}Expand description
Controls how a P2PSession reacts when a remote peer’s
automatic disconnect-timeout fires.
This setting governs ONLY the automatic timeout path. Explicit calls to
P2PSession::disconnect_player always preserve the legacy halt-on-drop
semantics regardless of this setting; explicit calls to
P2PSession::remove_player always perform a graceful drop regardless
of this setting. See those methods for details.
Defaults to DisconnectBehavior::Halt for back-compat with the legacy
GGRS-style behavior. Set DisconnectBehavior::ContinueWithout via
crate::SessionBuilder::with_disconnect_behavior to enable graceful
peer drop on auto-timeout, where the session continues advancing for the
remaining peers after a drop.
§Example
use fortress_rollback::{Config, DisconnectBehavior, SessionBuilder};
// Continue the session for remaining peers after a drop, freezing the
// dropped peer's input at their last confirmed value.
let builder = SessionBuilder::<MyConfig>::new()
.with_disconnect_behavior(DisconnectBehavior::ContinueWithout);Variants§
Halt
Halt the session: no further frames advance once any peer drops.
This is the legacy behavior inherited from GGRS. It is the default for
back-compat: existing applications that do not opt into
Self::ContinueWithout continue to observe the same
session-stops-on-drop semantics.
ContinueWithout
Continue the session with the remaining peers.
The dropped peer’s input queue is frozen (it repeats their last
confirmed input forever), and a crate::FortressEvent::PeerDropped
event is emitted. Remaining peers keep advancing frames using the
frozen input — the game layer decides how to handle the gameplay
impact (AI takeover, pause, end the match, etc.).
Note: this setting governs only the automatic disconnect-timeout
path. The legacy P2PSession::disconnect_player retains its original
non-graceful semantics regardless of this setting; for an explicit
graceful drop, use P2PSession::remove_player.
Trait Implementations§
Source§impl Clone for DisconnectBehavior
impl Clone for DisconnectBehavior
Source§fn clone(&self) -> DisconnectBehavior
fn clone(&self) -> DisconnectBehavior
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DisconnectBehavior
impl Debug for DisconnectBehavior
Source§impl Default for DisconnectBehavior
impl Default for DisconnectBehavior
Source§fn default() -> DisconnectBehavior
fn default() -> DisconnectBehavior
Source§impl Display for DisconnectBehavior
impl Display for DisconnectBehavior
Source§impl Hash for DisconnectBehavior
impl Hash for DisconnectBehavior
Source§impl PartialEq for DisconnectBehavior
impl PartialEq for DisconnectBehavior
Source§fn eq(&self, other: &DisconnectBehavior) -> bool
fn eq(&self, other: &DisconnectBehavior) -> bool
self and other values to be equal, and is used by ==.