feat(client): add specific warning kinds for dropped packets
This commit is contained in:
1 parent
b9fc4b9cee
commit
d212258707
3 files changed
+13
-2
No files matched your search
@@ -15,7 +15,7 @@ use crate::{
|
|||||||
error::ClientError,
|
error::ClientError,
|
||||||
event::{
|
event::{
|
||||||
ClientEvent, OneWayDelaySample, OpenOutcome, PacketMeta, ReceivedStatsSample, RttSample,
|
ClientEvent, OneWayDelaySample, OpenOutcome, PacketMeta, ReceivedStatsSample, RttSample,
|
||||||
ServerTiming,
|
ServerTiming, WarningKind,
|
||||||
},
|
},
|
||||||
probe::{CompletedSet, PendingMap, PendingProbe},
|
probe::{CompletedSet, PendingMap, PendingProbe},
|
||||||
session::{validate_negotiated_params, ActiveSession, ClientPhase, NegotiatedParams},
|
session::{validate_negotiated_params, ActiveSession, ClientPhase, NegotiatedParams},
|
||||||
@@ -337,6 +337,7 @@ impl Client {
|
|||||||
Ok(reply) => reply,
|
Ok(reply) => reply,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
return Ok(vec![ClientEvent::Warning {
|
return Ok(vec![ClientEvent::Warning {
|
||||||
|
kind: WarningKind::MalformedOrUnrelatedPacket,
|
||||||
message: "dropped malformed or unrelated packet".to_owned(),
|
message: "dropped malformed or unrelated packet".to_owned(),
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
@@ -348,6 +349,7 @@ impl Client {
|
|||||||
};
|
};
|
||||||
if reply.token != token {
|
if reply.token != token {
|
||||||
return Ok(vec![ClientEvent::Warning {
|
return Ok(vec![ClientEvent::Warning {
|
||||||
|
kind: WarningKind::WrongToken,
|
||||||
message: format!(
|
message: format!(
|
||||||
"dropped reply with wrong token: expected {token:#x}, got {:#x}",
|
"dropped reply with wrong token: expected {token:#x}, got {:#x}",
|
||||||
reply.token
|
reply.token
|
||||||
@@ -427,6 +429,7 @@ impl Client {
|
|||||||
}])
|
}])
|
||||||
} else {
|
} else {
|
||||||
Ok(vec![ClientEvent::Warning {
|
Ok(vec![ClientEvent::Warning {
|
||||||
|
kind: WarningKind::UntrackedReply,
|
||||||
message: format!(
|
message: format!(
|
||||||
"dropped reply with untracked seq {wire_seq} (no pending or completed entry)"
|
"dropped reply with untracked seq {wire_seq} (no pending or completed entry)"
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -77,10 +77,18 @@ pub enum ClientEvent {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Warning {
|
Warning {
|
||||||
|
kind: WarningKind,
|
||||||
message: String,
|
message: String,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub enum WarningKind {
|
||||||
|
MalformedOrUnrelatedPacket,
|
||||||
|
WrongToken,
|
||||||
|
UntrackedReply,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub struct RttSample {
|
pub struct RttSample {
|
||||||
pub raw: Duration,
|
pub raw: Duration,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ pub use config::{ClientConfig, NegotiationPolicy, RecvBudget, RunMode, SocketCon
|
|||||||
pub use error::ClientError;
|
pub use error::ClientError;
|
||||||
pub use event::{
|
pub use event::{
|
||||||
ClientEvent, OneWayDelaySample, OpenOutcome, PacketMeta, ReceivedStatsSample, RttSample,
|
ClientEvent, OneWayDelaySample, OpenOutcome, PacketMeta, ReceivedStatsSample, RttSample,
|
||||||
ServerTiming,
|
ServerTiming, WarningKind,
|
||||||
};
|
};
|
||||||
pub use session::NegotiatedParams;
|
pub use session::NegotiatedParams;
|
||||||
pub use timing::ClientTimestamp;
|
pub use timing::ClientTimestamp;
|
||||||
Reference in new issue
Block a user