From 9b3a6c024929ca0a4c08da1e70ca8fbd1e81b70b Mon Sep 17 00:00:00 2001 From: Joseph Beshay Date: Mon, 19 Sep 2022 17:39:32 -0700 Subject: [PATCH] If an initial packet is written, its padding should be allowed to bypass the cwnd Summary: When 0-rtt is used and an initial packet is lost, the retransmission of this packet may end up shorter than allowed because the padding frames are subject to the cwnd. This change makes the padding of initial packets not subject to the cwnd. Reviewed By: mjoras Differential Revision: D39594390 fbshipit-source-id: 2d714c921f243f8a59577a6edaaeaa1c7e2be815 --- quic/api/QuicPacketScheduler.cpp | 2 +- quic/api/test/QuicPacketSchedulerTest.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/quic/api/QuicPacketScheduler.cpp b/quic/api/QuicPacketScheduler.cpp index 58a7a9e14..2b171aae1 100644 --- a/quic/api/QuicPacketScheduler.cpp +++ b/quic/api/QuicPacketScheduler.cpp @@ -308,7 +308,7 @@ SchedulingResult FrameScheduler::scheduleFramesForPacket( longHeader && longHeader->getHeaderType() == LongHeader::Types::Initial; if (initialPacket) { // This is the initial packet, we need to fill er up. - while (wrapper.remainingSpaceInPkt() > 0) { + while (builder.remainingSpaceInPkt() > 0) { writeFrame(PaddingFrame(), builder); } } diff --git a/quic/api/test/QuicPacketSchedulerTest.cpp b/quic/api/test/QuicPacketSchedulerTest.cpp index 5b7785ab9..340261adf 100644 --- a/quic/api/test/QuicPacketSchedulerTest.cpp +++ b/quic/api/test/QuicPacketSchedulerTest.cpp @@ -227,7 +227,7 @@ TEST_F(QuicPacketSchedulerTest, PaddingInitialPureAcks) { EXPECT_EQ(conn.udpSendPacketLen, packetLength); } -TEST_F(QuicPacketSchedulerTest, PaddingUpToWrapperSize) { +TEST_F(QuicPacketSchedulerTest, InitialPaddingDoesNotUseWrapper) { QuicClientConnectionState conn( FizzClientQuicHandshakeContext::Builder().build()); auto connId = getTestConnectionId(); @@ -258,7 +258,7 @@ TEST_F(QuicPacketSchedulerTest, PaddingUpToWrapperSize) { std::move(builder), conn.udpSendPacketLen - cipherOverhead); auto packetLength = result.packet->header->computeChainDataLength() + result.packet->body->computeChainDataLength(); - EXPECT_EQ(conn.udpSendPacketLen - cipherOverhead, packetLength); + EXPECT_EQ(conn.udpSendPacketLen, packetLength); } TEST_F(QuicPacketSchedulerTest, CryptoServerInitialPadded) {