Skip to content

Commit

Permalink
Fixes and api completion
Browse files Browse the repository at this point in the history
  • Loading branch information
guhetier committed Feb 4, 2025
1 parent b94bb5e commit 8c41ee5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/core/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,7 @@ MsQuicStreamProvideReceiveBuffers(
}
Oper->API_CALL.Context->Type = QUIC_API_TYPE_STRM_PROVIDE_RECV_BUFFERS;
Oper->API_CALL.Context->STRM_PROVIDE_RECV_BUFFERS.Stream = Stream;
CxPlatListInitializeHead(&Oper->API_CALL.Context->STRM_PROVIDE_RECV_BUFFERS.Chunks);
CxPlatListMoveItems(&ChunkList, &Oper->API_CALL.Context->STRM_PROVIDE_RECV_BUFFERS.Chunks);

Check warning on line 1473 in src/core/api.c

View check run for this annotation

Codecov / codecov/patch

src/core/api.c#L1470-L1473

Added lines #L1470 - L1473 were not covered by tests

//
Expand Down
9 changes: 9 additions & 0 deletions src/core/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,15 @@ MsQuicStreamReceiveComplete(
_In_ uint64_t BufferLength
);

_IRQL_requires_max_(DISPATCH_LEVEL)
QUIC_STATUS
QUIC_API
MsQuicStreamProvideReceiveBuffers(
_In_ _Pre_defensive_ HQUIC Handle,
_In_ uint32_t BufferCount,
_In_reads_(BufferCount) const QUIC_BUFFER *Buffers
);

_IRQL_requires_max_(DISPATCH_LEVEL)
QUIC_STATUS
QUIC_API
Expand Down
1 change: 1 addition & 0 deletions src/core/library.c
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,7 @@ MsQuicOpenVersion(
Api->StreamSend = MsQuicStreamSend;
Api->StreamReceiveComplete = MsQuicStreamReceiveComplete;
Api->StreamReceiveSetEnabled = MsQuicStreamReceiveSetEnabled;
Api->StreamProvideReceiveBuffers = MsQuicStreamProvideReceiveBuffers;

Api->DatagramSend = MsQuicDatagramSend;

Expand Down
3 changes: 2 additions & 1 deletion src/core/recv_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,8 @@ QuicRecvBufferPartialDrain(
// In external mode, memory is never re-used: a drain consumes
// virtual buffer length.
//
RecvBuffer->VirtualBufferLength -= RecvBuffer->ReadLength;
CXPLAT_DBG_ASSERT(RecvBuffer->VirtualBufferLength >= (uint32_t)DrainLength);
RecvBuffer->VirtualBufferLength -= (uint32_t)DrainLength;

Check warning on line 1095 in src/core/recv_buffer.c

View check run for this annotation

Codecov / codecov/patch

src/core/recv_buffer.c#L1094-L1095

Added lines #L1094 - L1095 were not covered by tests
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/core/stream_recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,8 @@ QuicStreamOnBytesDelivered(
//
// Limit stream FC window growth by the connection FC window size.
//
if (Stream->RecvBuffer.VirtualBufferLength <
Stream->Connection->Settings.ConnFlowControlWindow) {
if (Stream->RecvBuffer.VirtualBufferLength != 0 &&
Stream->RecvBuffer.VirtualBufferLength < Stream->Connection->Settings.ConnFlowControlWindow) {

uint64_t TimeThreshold =
((Stream->RecvWindowBytesDelivered * Stream->Connection->Paths[0].SmoothedRtt) / RecvBufferDrainThreshold);
Expand Down Expand Up @@ -831,7 +831,7 @@ QuicStreamOnBytesDelivered(
"Updating flow control window");

CXPLAT_DBG_ASSERT(
Stream->RecvBuffer.BaseOffset + Stream->RecvBuffer.VirtualBufferLength >
Stream->RecvBuffer.BaseOffset + Stream->RecvBuffer.VirtualBufferLength >=
Stream->MaxAllowedRecvOffset);

Stream->MaxAllowedRecvOffset =
Expand Down

0 comments on commit 8c41ee5

Please sign in to comment.