Skip to main content

socket_snapshot

Function socket_snapshot 

Source
pub fn socket_snapshot<A: AsRawFd>(socket: &A) -> Option<TcpSnapshot>
Expand description

Smoothed RTT + human-readable TCP state ("ESTABLISHED", "SYN_SENT", "CLOSE_WAIT", …) pulled from a single getsockopt(TCP_INFO) call. Returns None when the kernel refuses the call — e.g. the socket has been closed, or the FSM is in a state where TCP_INFO is not usable. Safe on dying/refused sockets: the inner syscall’s status != 0 branch is the only failure mode and it degrades to None.