Discard pre-handshake packets after the handshake

Attempting to parse frames from these non-frame-bearing packets was
responsible for some spurious connection failures in interop testing
under high packet loss.
This commit is contained in:
Benjamin Saunders
2024-07-24 00:58:20 -07:00
parent 2a3ef522af
commit d7abf0aaab
2 changed files with 16 additions and 1 deletions
+4 -1
View File
@@ -2301,7 +2301,10 @@ impl Connection {
State::Established => {
match packet.header.space() {
SpaceId::Data => self.process_payload(now, remote, number.unwrap(), packet)?,
_ => self.process_early_payload(now, packet)?,
_ if packet.header.has_frames() => self.process_early_payload(now, packet)?,
_ => {
trace!("discarding unexpected pre-handshake packet");
}
}
return Ok(());
}
+12
View File
@@ -445,6 +445,18 @@ impl Header {
VersionNegotiate { ref dst_cid, .. } => dst_cid,
}
}
/// Whether the payload of this packet contains QUIC frames
pub(crate) fn has_frames(&self) -> bool {
use Header::*;
match *self {
Initial(_) => true,
Long { .. } => true,
Retry { .. } => false,
Short { .. } => true,
VersionNegotiate { .. } => false,
}
}
}
pub(crate) struct PartialEncode {