From 1e1504b0b218bbc53da8ecddead50ab4e5a7b33d Mon Sep 17 00:00:00 2001 From: Thad House Date: Tue, 13 Jul 2021 13:53:34 -0700 Subject: [PATCH] Fix queuing 0-RTT data during handshake (#1817) Previously, if 0-RTT data was queued during the handshake, it has the potential to not queue the flush send. This makes it so if we have 0-RTT flags and sends are queued, we'll allow them to be flushed. Also, there are cases where we could end up with stream data but no flags, which if this occured during the handshake would hit an assert. This assert is only there to tell if we're going to do no work, but this would only be a slight perf penalty when it does happen, so its not a valid assert --- src/core/send.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/send.c b/src/core/send.c index c8bd7f9ed6..7564260da8 100644 --- a/src/core/send.c +++ b/src/core/send.c @@ -106,6 +106,10 @@ QuicSendCanSendFlagsNow( { QUIC_CONNECTION* Connection = QuicSendGetConnection(Send); if (Connection->Crypto.TlsState.WriteKey < QUIC_PACKET_KEY_1_RTT) { + if (Connection->Crypto.TlsState.WriteKeys[QUIC_PACKET_KEY_0_RTT] != NULL && + CxPlatListIsEmpty(&Send->SendStreams)) { + return TRUE; + } if ((!Connection->State.Started && !QuicConnIsServer(Connection)) || !(Send->SendFlags & QUIC_CONN_SEND_FLAG_ALLOWED_HANDSHAKE)) { return FALSE; @@ -1091,8 +1095,6 @@ QuicSendFlush( return TRUE; } - CXPLAT_DBG_ASSERT(QuicSendCanSendFlagsNow(Send)); - QUIC_SEND_RESULT Result = QUIC_SEND_INCOMPLETE; QUIC_STREAM* Stream = NULL; uint32_t StreamPacketCount = 0;