diff --git a/crates/irtt-stats/src/loss.rs b/crates/irtt-stats/src/loss.rs index c9191ba..a705f24 100644 --- a/crates/irtt-stats/src/loss.rs +++ b/crates/irtt-stats/src/loss.rs @@ -7,10 +7,8 @@ use crate::PacketCounts; /// Directional upstream and downstream loss can be negative when /// server-reported counts exceed local expectations. pub struct LossStats { - /// Locally inferred lost packets. + /// Locally inferred total lost packets. pub lost_packets: u64, - /// Loss not attributed to a direction. - pub unknown_loss_packets: u64, /// Server-assisted upstream loss estimate, when server counts are available. pub upstream_loss_packets: Option, /// Server-assisted downstream loss estimate, when server counts are available. @@ -67,7 +65,6 @@ pub(crate) fn loss_stats(packets: PacketCounts) -> LossStats { LossStats { lost_packets: lost, - unknown_loss_packets: lost, upstream_loss_packets, downstream_loss_packets, packet_loss_percent, diff --git a/crates/irtt-stats/tests/stats.rs b/crates/irtt-stats/tests/stats.rs index b8102cd..f1eaf5e 100644 --- a/crates/irtt-stats/tests/stats.rs +++ b/crates/irtt-stats/tests/stats.rs @@ -264,7 +264,9 @@ fn directional_loss_uses_server_received_count_when_available() { collector.process(&reply(0, 10, 10)); let loss = collector.snapshot().loss; + assert_eq!(loss.lost_packets, 1); assert_eq!(loss.upstream_loss_packets, Some(1)); assert_eq!(loss.downstream_loss_packets, Some(0)); + assert_eq!(loss.packet_loss_percent, 50.0); assert_eq!(loss.upstream_loss_percent, 50.0); }