Skip to content

Commit

Permalink
fix as proposed
Browse files Browse the repository at this point in the history
  • Loading branch information
ami-GS committed Jan 16, 2025
1 parent 1f9c6e9 commit 101f6b9
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions src/inc/quic_platform_winkernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -578,23 +578,30 @@ CxPlatEventQDequeue(
_In_ uint32_t wait_time // milliseconds
)
{
LARGE_INTEGER timeout;
timeout.QuadPart = -10000LL * wait_time;

ULONG entriesRemoved = 0;
NTSTATUS status = ZwRemoveIoCompletionEx(
*queue,
events,
count,
&entriesRemoved,
(wait_time == UINT32_MAX) ? NULL : &timeout,
FALSE
);

if (!NT_SUCCESS(status)) {
return 0;
NTSTATUS status;
ULONG entriesRemoved;
if (wait_time == UINT32_MAX) {
status =
ZwRemoveIoCompletionEx(
*queue,
events,
count,
&entriesRemoved,
NULL,
FALSE);
} else {
LARGE_INTEGER timeout;
timeout.QuadPart = -10000LL * wait_time;
status =
ZwRemoveIoCompletionEx(
*queue,
events,
count,
&entriesRemoved,
&timeout,
FALSE);
}
return entriesRemoved;
return NT_SUCCESS(status) ? entriesRemoved : 0;
}

_IRQL_requires_max_(PASSIVE_LEVEL)
Expand Down

0 comments on commit 101f6b9

Please sign in to comment.