From fcee41415294367551a6af21de07ba85759598e4 Mon Sep 17 00:00:00 2001 From: Steve Fan Date: Wed, 8 Oct 2025 10:09:01 +0800 Subject: [PATCH 1/2] increase DeferredPacketsCount type to uint16_t and adjust max pending datagrams calculation --- src/core/connection.c | 6 +++++- src/core/packet_space.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/connection.c b/src/core/connection.c index c297719e23..c9b653c67f 100644 --- a/src/core/connection.c +++ b/src/core/connection.c @@ -3716,7 +3716,11 @@ QuicConnGetKeyOrDeferDatagram( } else { QUIC_ENCRYPT_LEVEL EncryptLevel = QuicKeyTypeToEncryptLevel(Packet->KeyType); QUIC_PACKET_SPACE* Packets = Connection->Packets[EncryptLevel]; - if (Packets->DeferredPacketsCount == QUIC_MAX_PENDING_DATAGRAMS) { + uint32_t MaxPendingDatagrams = ( + Connection->Settings.IsSet.InitialWindowPackets + ? Connection->Settings.InitialWindowPackets + : QUIC_INITIAL_WINDOW_PACKETS) + 5; + if (Packets->DeferredPacketsCount == MaxPendingDatagrams) { // // We already have too many packets queued up. Just drop this // one. diff --git a/src/core/packet_space.h b/src/core/packet_space.h index df5f0c92f7..9aac155f97 100644 --- a/src/core/packet_space.h +++ b/src/core/packet_space.h @@ -54,7 +54,7 @@ typedef struct QUIC_PACKET_SPACE { // // Numbers of entries in the DeferredPackets list. // - uint8_t DeferredPacketsCount; + uint16_t DeferredPacketsCount; // // The (expected) next packet number to receive. Used for decoding received From 4bb378bd5203c1ccf6a31e2ef4842732b0fe0042 Mon Sep 17 00:00:00 2001 From: Steve Fan Date: Wed, 8 Oct 2025 10:15:36 +0800 Subject: [PATCH 2/2] change MaxPendingDatagrams to a const variable and remove redundant definition --- src/core/connection.c | 2 +- src/core/quicdef.h | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/core/connection.c b/src/core/connection.c index c9b653c67f..e7e066406e 100644 --- a/src/core/connection.c +++ b/src/core/connection.c @@ -3716,7 +3716,7 @@ QuicConnGetKeyOrDeferDatagram( } else { QUIC_ENCRYPT_LEVEL EncryptLevel = QuicKeyTypeToEncryptLevel(Packet->KeyType); QUIC_PACKET_SPACE* Packets = Connection->Packets[EncryptLevel]; - uint32_t MaxPendingDatagrams = ( + const uint32_t MaxPendingDatagrams = ( Connection->Settings.IsSet.InitialWindowPackets ? Connection->Settings.InitialWindowPackets : QUIC_INITIAL_WINDOW_PACKETS) + 5; diff --git a/src/core/quicdef.h b/src/core/quicdef.h index 4491b5c599..337fc5ea21 100644 --- a/src/core/quicdef.h +++ b/src/core/quicdef.h @@ -206,13 +206,6 @@ typedef struct QUIC_RX_PACKET QUIC_RX_PACKET; // #define QUIC_MAX_RECEIVE_FLUSH_COUNT 100 -// -// The maximum number of pending datagrams we will hold on to, per connection, -// per packet number space. We base our max on the expected initial window size -// of the peer with a little bit of extra. -// -#define QUIC_MAX_PENDING_DATAGRAMS (QUIC_INITIAL_WINDOW_PACKETS + 5) - // // The maximum crypto FC window we will use/allow for client buffers. //