pub struct ClientRecord {
pub last_seen: f64,
pub requests: u64,
pub responses: u64,
pub dropped: u64,
pub last_receive: NtpTimestamp,
pub last_transmit: NtpTimestamp,
pub last_receive_sent: NtpTimestamp,
pub interleaved_now: bool,
/* private fields */
}Expand description
Per-client state: enough for rate limiting, interleaved mode and the MRU report, and no more — this is multiplied by every client that has ever spoken to us.
Fields§
§last_seen: f64§requests: u64§responses: u64§dropped: u64§last_receive: NtpTimestampT2 of the last request we accepted. NtpTimestamp::ZERO until there
has been one.
Zero rather than Option deliberately: NtpTimestamp is a bare u64
with no niche, so Option<NtpTimestamp> is SIXTEEN bytes for eight
bytes of payload and every read tests a discriminant. An all-zero
timestamp is already how RFC 5905 spells “unset” on the wire, so the
sentinel is the protocol’s own, not one invented here
(rusty-compiler-leverage B5: the one win in that table was a
representation change, not a bit trick).
last_transmit: NtpTimestampThe true transmit timestamp of our last response, once the driver
reports it. NtpTimestamp::ZERO until then, which is why interleaved
mode cannot answer the very first request.
last_receive_sent: NtpTimestampThe receive timestamp we put in our last response. A client asks for
interleaved mode by echoing exactly this. NtpTimestamp::ZERO until
we have answered once.
interleaved_now: boolWhether the last answered request was actually served interleaved.
Distinct from “we could serve it interleaved”: every client we have answered once is capable, but only a client that asks is using it, and an operator reading a client log needs the second fact.