pub struct ConnectionLifecycle {
pub conn_id: ConnectionId,
pub role: ConnectionRole,
pub state: ConnectionState,
pub initiated_at: Instant,
pub handshake_started_at: Option<Instant>,
pub established_at: Option<Instant>,
pub closed_at: Option<Instant>,
pub close_reason: Option<String>,
pub total_bytes_sent: u64,
pub total_bytes_received: u64,
pub total_packets_sent: u64,
pub total_packets_received: u64,
}
Expand description
Connection lifecycle tracker
Fields§
§conn_id: ConnectionId
Identifier for the connection being tracked
role: ConnectionRole
Role of the connection (client or server)
state: ConnectionState
Current lifecycle state
initiated_at: Instant
Timestamp when the connection was initiated
handshake_started_at: Option<Instant>
Timestamp when handshake started, if applicable
established_at: Option<Instant>
Timestamp when connection was established, if applicable
closed_at: Option<Instant>
Timestamp when connection was closed, if applicable
close_reason: Option<String>
Reason for closure, if provided
total_bytes_sent: u64
Total bytes sent over the lifetime
total_bytes_received: u64
Total bytes received over the lifetime
total_packets_sent: u64
Total packets sent over the lifetime
total_packets_received: u64
Total packets received over the lifetime
Implementations§
Source§impl ConnectionLifecycle
impl ConnectionLifecycle
Sourcepub fn new(conn_id: ConnectionId, role: ConnectionRole) -> Self
pub fn new(conn_id: ConnectionId, role: ConnectionRole) -> Self
Create a new connection lifecycle tracker
Sourcepub fn update_state(&mut self, new_state: ConnectionState)
pub fn update_state(&mut self, new_state: ConnectionState)
Update connection state
Sourcepub fn log_summary(&self)
pub fn log_summary(&self)
Log connection summary when closed
Auto Trait Implementations§
impl Freeze for ConnectionLifecycle
impl RefUnwindSafe for ConnectionLifecycle
impl Send for ConnectionLifecycle
impl Sync for ConnectionLifecycle
impl Unpin for ConnectionLifecycle
impl UnwindSafe for ConnectionLifecycle
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