From c2467fa61df1ccbdd26e3582c88ca5377c701acd Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Tue, 23 Feb 2021 19:07:27 -0800 Subject: [PATCH] Apply client initial padding consistently Fixes unconditional padding of close packets --- quinn-proto/src/connection/mod.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/quinn-proto/src/connection/mod.rs b/quinn-proto/src/connection/mod.rs index d39f26dec..ffdbfbee0 100644 --- a/quinn-proto/src/connection/mod.rs +++ b/quinn-proto/src/connection/mod.rs @@ -612,8 +612,6 @@ where "tried to make a close packet when the connection wasn't closed" ), } - // A close frame in the initial space requires padding - pad_datagram = true; coalesce = false; // We don't want to send 2 close packets close = false; @@ -634,6 +632,8 @@ where pad_datagram |= sent.requires_padding; } + pad_datagram |= space_id == SpaceId::Initial && self.side.is_client(); + // Don't increment space_idx. // We stay in the current space and check if there is more data to send. } @@ -2923,10 +2923,6 @@ where let space = &mut self.spaces[space_id]; let is_0rtt = space_id == SpaceId::Data && space.crypto.is_none(); - if space_id == SpaceId::Initial && self.side.is_client() { - sent.requires_padding = true; - } - // HANDSHAKE_DONE if !is_0rtt && mem::replace(&mut space.pending.handshake_done, false) { buf.write(frame::Type::HANDSHAKE_DONE);