From 6fc46aefc65aeb3dd2d059ea6aabaf7a6c2f5bdb Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Fri, 25 Mar 2022 12:36:15 -0700 Subject: [PATCH] Discard retry token when no longer needed --- quinn-proto/src/connection/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/quinn-proto/src/connection/mod.rs b/quinn-proto/src/connection/mod.rs index ac2c4452b..06e497a13 100644 --- a/quinn-proto/src/connection/mod.rs +++ b/quinn-proto/src/connection/mod.rs @@ -178,7 +178,8 @@ pub struct Connection { authentication_failures: u64, /// Why the connection was lost, if it has been error: Option, - /// Sent in every outgoing Initial packet. Always empty for servers. + /// Sent in every outgoing Initial packet. Always empty for servers and after Initial keys are + /// discarded. retry_token: Bytes, // @@ -1776,6 +1777,10 @@ impl Connection { fn discard_space(&mut self, now: Instant, space_id: SpaceId) { debug_assert!(space_id != SpaceId::Data); trace!("discarding {:?} keys", space_id); + if space_id == SpaceId::Initial { + // No longer needed + self.retry_token = Bytes::new(); + } let space = &mut self.spaces[space_id]; space.crypto = None; space.time_of_last_ack_eliciting_packet = None;