docs(stats): clarify server receive-window semantics
An audit of the server-reported receive window found no defect in the statistics pipeline: the bitmap is decoded raw, stored raw, never interpreted, and never feeds the directional loss estimates, which use the cumulative server receive count. The public rustdoc was silent on all of that, leaving consumers of PacketCounts free to read a window of 0x1 as a 63-packet loss burst. Document the field's contract, name the count as the only server input to LossStats, and cover the window-only case with a regression test.
This commit is contained in:
5 files changed
+67
-3
No files matched your search
@@ -84,6 +84,22 @@ fn reply_with_rtt(seq: u32, raw_ms: u64, rtt: RttSample) -> ClientEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/// Builds a normal reply carrying exactly the supplied server received stats.
|
||||
pub fn reply_with_received_stats(
|
||||
seq: u32,
|
||||
raw_ms: u64,
|
||||
count: Option<u32>,
|
||||
window: Option<u64>,
|
||||
) -> ClientEvent {
|
||||
let mut event = unadjusted_reply(seq, raw_ms);
|
||||
let ClientEvent::EchoReply { received_stats, .. } = &mut event else {
|
||||
unreachable!();
|
||||
};
|
||||
*received_stats =
|
||||
(count.is_some() || window.is_some()).then_some(ReceivedStatsSample { count, window });
|
||||
event
|
||||
}
|
||||
|
||||
pub fn unadjusted_late_reply(seq: u32, raw_ms: u64) -> ClientEvent {
|
||||
late_reply_from(unadjusted_reply(seq, raw_ms))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user