pub enum PeerState {
Idle,
Connecting,
AcknowledgingConnect,
ConnectionSucceeded,
Connected,
Disconnecting,
Zombie,
}Expand description
Peer connection state machine.
Tracks the lifecycle of a peer connection from initial contact through active communication to graceful shutdown.
Variants§
Idle
Peer has been created but no packets exchanged yet
Connecting
Client: Sent CONNECT, waiting for VERIFY_CONNECT
AcknowledgingConnect
Server: Received CONNECT, sent VERIFY_CONNECT, waiting for ACK
ConnectionSucceeded
Client: Received VERIFY_CONNECT, sent ACK, waiting for confirmation
Connected
Both sides have completed handshake - connection is active
Disconnecting
Disconnect command sent, waiting for acknowledgment
Zombie
Peer is being cleaned up (zombie state before removal)
Implementations§
Source§impl PeerState
impl PeerState
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Returns true if the peer is in an active state where data can be sent
Sourcepub fn is_established(&self) -> bool
pub fn is_established(&self) -> bool
Returns true if the connection is fully established
Sourcepub fn is_disconnecting(&self) -> bool
pub fn is_disconnecting(&self) -> bool
Returns true if the peer is disconnecting or already disconnected
Sourcepub fn is_connecting(&self) -> bool
pub fn is_connecting(&self) -> bool
Returns true if the peer is in the middle of connection handshake