Expose fragment-set evictions in transport stats

A receiver that survives loss by discarding stranded sets has to say so, or
the drop is invisible and the next diagnosis starts from "delivered less
than sent" again. CultNetTransportStats now carries fragment_sets_evicted,
summed across hub peers like reliable_packets_expired, and the media
delivery probe prints it beside delivered_pct.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-10 11:40:11 +02:00
commit 66f05e161a
3 changed files with 13 additions and 2 deletions

View file

@ -87,10 +87,11 @@ fn recv(bind: SocketAddr, expect: u64) -> Result<()> {
let elapsed = started.elapsed().as_secs_f64();
println!("RESULT recv frames={frames} expected={expect} payload_bytes={payload_bytes}");
println!(
"RESULT recv wire_bytes_in={} wire_bytes_out={} elapsed_s={elapsed:.2} delivered_pct={:.2}",
"RESULT recv wire_bytes_in={} wire_bytes_out={} elapsed_s={elapsed:.2} delivered_pct={:.2} fragment_sets_evicted={}",
stats.bytes_received,
stats.bytes_sent,
(frames as f64 / expect as f64) * 100.0
(frames as f64 / expect as f64) * 100.0,
stats.fragment_sets_evicted
);
Ok(())
}

View file

@ -1453,6 +1453,11 @@ impl CultNetRudpServerHub {
.values()
.map(|peer| peer.session.reliable_packets_expired())
.fold(0_u64, |total, expired| total.saturating_add(expired));
stats.fragment_sets_evicted = self
.peers
.values()
.map(|peer| peer.session.fragment_sets_evicted())
.fold(0_u64, |total, evicted| total.saturating_add(evicted));
stats
}
@ -1754,6 +1759,7 @@ impl CultNetRudpSocketTransportConnection {
pub fn stats(&self) -> CultNetTransportStats {
let mut stats = self.stats.clone();
stats.reliable_packets_expired = self.session.reliable_packets_expired();
stats.fragment_sets_evicted = self.session.fragment_sets_evicted();
stats
}

View file

@ -22,6 +22,10 @@ pub struct CultNetTransportStats {
/// Reliable packets dropped by a send-side expiry deadline instead of being
/// retransmitted. Always zero for transports without reliable expiry.
pub reliable_packets_expired: u64,
/// Incomplete fragment sets discarded to admit newer ones. Each is one
/// payload that lost a fragment on the wire. Zero for non-fragmenting
/// transports.
pub fragment_sets_evicted: u64,
}
#[derive(Clone, Debug, PartialEq, Eq)]