Expand description
Socket statistics
Structs§
- TcpSnapshot
- Point-in-time snapshot of kernel TCP bookkeeping for a socket. Populated
from a single
getsockopt(TCP_INFO)syscall so callers that want both the smoothed RTT and the FSM state don’t pay for two trips into the kernel. Field set is deliberately narrow — extend with moretcp_infomembers if the log prefix grows.
Functions§
- socket_
info - socket_
rtt - Round trip time for a TCP socket. Kept for existing metric callers;
log-prefix callers should prefer
socket_snapshotwhich returns the RTT and the TCP FSM state from a single syscall. - socket_
snapshot - Smoothed RTT + human-readable TCP state (
"ESTABLISHED","SYN_SENT","CLOSE_WAIT", …) pulled from a singlegetsockopt(TCP_INFO)call. ReturnsNonewhen the kernel refuses the call — e.g. the socket has been closed, or the FSM is in a state whereTCP_INFOis not usable. Safe on dying/refused sockets: the inner syscall’sstatus != 0branch is the only failure mode and it degrades toNone.