Skip to content

Commit

Permalink
Fix queuing 0-RTT data during handshake (microsoft#1817)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ThadHouse authored Jul 13, 2021
1 parent efcbbae commit 1e1504b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1e1504b

Please sign in to comment.