Skip to content

Commit 3a6f859

Browse files
committed
Refactor queue limit (#4098)
1 parent 9ba864c commit 3a6f859

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/core/connection.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3149,6 +3149,14 @@ QuicConnQueueRecvPackets(
31493149
PacketsTail = (QUIC_RX_PACKET**)&((*PacketsTail)->Next);
31503150
}
31513151

3152+
//
3153+
// Base the limit of queued packets on the connection-wide flow control, but
3154+
// allow at least a few packets even if the app configured an extremely
3155+
// tiny FC window.
3156+
//
3157+
const uint32_t QueueLimit =
3158+
CXPLAT_MAX(10, Connection->Settings.ConnFlowControlWindow >> 10);
3159+
31523160
QuicTraceLogConnVerbose(
31533161
QueueDatagrams,
31543162
Connection,
@@ -3157,7 +3165,7 @@ QuicConnQueueRecvPackets(
31573165

31583166
BOOLEAN QueueOperation;
31593167
CxPlatDispatchLockAcquire(&Connection->ReceiveQueueLock);
3160-
if (Connection->ReceiveQueueCount >= QUIC_MAX_RECEIVE_QUEUE_COUNT) {
3168+
if (Connection->ReceiveQueueCount >= QueueLimit) {
31613169
QueueOperation = FALSE;
31623170
} else {
31633171
*Connection->ReceiveQueueTail = Packets;

src/core/quicdef.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,6 @@ typedef struct QUIC_RX_PACKET QUIC_RX_PACKET;
194194
//
195195
#define QUIC_MAX_CRYPTO_BATCH_COUNT 8
196196

197-
//
198-
// The maximum number of received packets that may be queued on a single
199-
// connection. When this limit is reached, any additional packets are dropped.
200-
//
201-
#ifdef _KERNEL_MODE
202-
#define QUIC_MAX_RECEIVE_QUEUE_COUNT 1024
203-
#else
204-
#define QUIC_MAX_RECEIVE_QUEUE_COUNT 8192
205-
#endif
206-
207197
//
208198
// The maximum number of received packets that may be processed in a single
209199
// flush operation.

0 commit comments

Comments
 (0)