feat(client): add specific warning kinds for dropped packets

This commit is contained in:
Nils Andreas Svee committed 2026-05-10 20:56:43 +07:00
1 parent b9fc4b9cee
commit d212258707
3 files changed
+13 -2

No files matched your search

+4 -1
View File
@@ -15,7 +15,7 @@ use crate::{
error::ClientError,
event::{
ClientEvent, OneWayDelaySample, OpenOutcome, PacketMeta, ReceivedStatsSample, RttSample,
ServerTiming,
ServerTiming, WarningKind,
},
probe::{CompletedSet, PendingMap, PendingProbe},
session::{validate_negotiated_params, ActiveSession, ClientPhase, NegotiatedParams},
@@ -337,6 +337,7 @@ impl Client {
Ok(reply) => reply,
Err(_) => {
return Ok(vec![ClientEvent::Warning {
kind: WarningKind::MalformedOrUnrelatedPacket,
message: "dropped malformed or unrelated packet".to_owned(),
}]);
}
@@ -348,6 +349,7 @@ impl Client {
};
if reply.token != token {
return Ok(vec![ClientEvent::Warning {
kind: WarningKind::WrongToken,
message: format!(
"dropped reply with wrong token: expected {token:#x}, got {:#x}",
reply.token
@@ -427,6 +429,7 @@ impl Client {
}])
} else {
Ok(vec![ClientEvent::Warning {
kind: WarningKind::UntrackedReply,
message: format!(
"dropped reply with untracked seq {wire_seq} (no pending or completed entry)"
),
+8
View File
@@ -77,10 +77,18 @@ pub enum ClientEvent {
},
Warning {
kind: WarningKind,
message: String,
},
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum WarningKind {
MalformedOrUnrelatedPacket,
WrongToken,
UntrackedReply,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct RttSample {
pub raw: Duration,
+1 -1
View File
@@ -14,7 +14,7 @@ pub use config::{ClientConfig, NegotiationPolicy, RecvBudget, RunMode, SocketCon
pub use error::ClientError;
pub use event::{
ClientEvent, OneWayDelaySample, OpenOutcome, PacketMeta, ReceivedStatsSample, RttSample,
ServerTiming,
ServerTiming, WarningKind,
};
pub use session::NegotiatedParams;
pub use timing::ClientTimestamp;