Skip to main content

Module stats

Module stats 

Source
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 more tcp_info members 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_snapshot which 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 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.