Apply client initial padding consistently

Fixes unconditional padding of close packets
This commit is contained in:
Benjamin Saunders
2021-02-23 19:07:27 -08:00
committed by Dirkjan Ochtman
parent 4d3a57cfaf
commit c2467fa61d
+2 -6
View File
@@ -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);