Skip to content

Commit 00078ed

Browse files
committed
Fix test case and comment
1 parent 167c169 commit 00078ed

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/core/recv_buffer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ QuicRecvBufferInitialize(
273273
{
274274
CXPLAT_DBG_ASSERT(AllocBufferLength != 0 || RecvMode == QUIC_RECV_BUF_MODE_APP_OWNED);
275275
CXPLAT_DBG_ASSERT(VirtualBufferLength != 0 || RecvMode == QUIC_RECV_BUF_MODE_APP_OWNED);
276+
CXPLAT_DBG_ASSERT(PreallocatedChunk == NULL || RecvMode != QUIC_RECV_BUF_MODE_APP_OWNED);
276277
CXPLAT_DBG_ASSERT((AllocBufferLength & (AllocBufferLength - 1)) == 0); // Power of 2
277278
CXPLAT_DBG_ASSERT((VirtualBufferLength & (VirtualBufferLength - 1)) == 0); // Power of 2
278279
CXPLAT_DBG_ASSERT(AllocBufferLength <= VirtualBufferLength);

src/core/recv_buffer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ typedef struct QUIC_RECV_BUFFER {
105105
//
106106
// Initialize a QUIC_RECV_BUFFER.
107107
// Can only fail if PreallocatedChunk == NULL && RecvMode != QUIC_RECV_BUF_MODE_APP_OWNED.
108-
// PreallocatedChunk is owned by the caller and must be freed afte the buffer is uninitialized.
108+
// PreallocatedChunk ownership is given to the receive buffer.
109+
// PreallocatedChunk must be null if RecvMode == QUIC_RECV_BUF_MODE_APP_OWNED.
109110
//
110111
_IRQL_requires_max_(DISPATCH_LEVEL)
111112
QUIC_STATUS

src/core/unittest/RecvBufferTest.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,11 @@ TEST_P(WithMode, Alloc)
312312
TEST_P(WithMode, AllocWithChunk)
313313
{
314314
RecvBuffer RecvBuf;
315+
const auto Mode = GetParam();
316+
if (Mode == QUIC_RECV_BUF_MODE_APP_OWNED) {
317+
// App-owned mode doesn't support preallocated chunks
318+
return;
319+
}
315320
ASSERT_EQ(QUIC_STATUS_SUCCESS, RecvBuf.Initialize(GetParam(), true));
316321
}
317322

0 commit comments

Comments
 (0)