pub struct ConnectionState {Show 15 fields
pub session_id: SessionId,
pub phase: ConnectionPhase,
pub remote_endpoint: SocketAddr,
pub last_received: Instant,
pub epoch: u32,
pub send_nonce: u64,
pub recv_nonce_window: NonceWindow,
pub rtt: RttEstimator,
pub timestamps: TimestampTracker,
pub pacer: FramePacer,
pub retransmit: RetransmitController,
pub migration: MigrationState,
pub local_state_version: u64,
pub remote_state_version: u64,
pub acked_state_version: u64,
}transport only.Expand description
Full connection state as specified in 2-TRANSPORT.md.
Fields§
§session_id: SessionIdSession identifier from handshake.
phase: ConnectionPhaseCurrent connection phase.
remote_endpoint: SocketAddrRemote peer address (may change during migration).
last_received: InstantWhen we last received an authenticated frame.
epoch: u32Current epoch (increments on rekey).
send_nonce: u64Outbound nonce counter (monotonically increasing).
recv_nonce_window: NonceWindowInbound anti-replay window.
rtt: RttEstimatorRTT estimation.
timestamps: TimestampTrackerTimestamp tracking for RTT measurement.
pacer: FramePacerFrame pacing.
retransmit: RetransmitControllerRetransmission control.
migration: MigrationStateMigration state.
local_state_version: u64Highest state version we’ve sent.
remote_state_version: u64Highest state version we’ve acknowledged from peer.
acked_state_version: u64Highest state version the peer has acknowledged from us.
Implementations§
Source§impl ConnectionState
impl ConnectionState
Sourcepub fn new(session_id: SessionId, remote_endpoint: SocketAddr) -> Self
pub fn new(session_id: SessionId, remote_endpoint: SocketAddr) -> Self
Create a new connection state for an established session.
Sourcepub fn handshaking(remote_endpoint: SocketAddr) -> Self
pub fn handshaking(remote_endpoint: SocketAddr) -> Self
Create a connection state in handshaking phase.
Sourcepub fn next_send_nonce(&mut self) -> u64
pub fn next_send_nonce(&mut self) -> u64
Get the next nonce for sending and increment the counter.
Sourcepub fn check_recv_nonce(&mut self, nonce: u64) -> bool
pub fn check_recv_nonce(&mut self, nonce: u64) -> bool
Check if a received nonce is valid (not replayed).
Sourcepub fn on_authenticated_frame(&mut self, from: SocketAddr)
pub fn on_authenticated_frame(&mut self, from: SocketAddr)
Update state after receiving an authenticated frame.
Sourcepub fn has_unacked_data(&self) -> bool
pub fn has_unacked_data(&self) -> bool
Check if there’s unacknowledged data.
Sourcepub fn mark_closed(&mut self)
pub fn mark_closed(&mut self)
Mark as fully closed.
Sourcepub fn mark_failed(&mut self)
pub fn mark_failed(&mut self)
Mark as failed.
Sourcepub fn complete_handshake(&mut self, session_id: SessionId)
pub fn complete_handshake(&mut self, session_id: SessionId)
Complete handshake and transition to established.