From 1964ff934f18f4c0a6f8d4860b929f0d9dcf5f78 Mon Sep 17 00:00:00 2001 From: ami-GS <1991.daiki@gmail.com> Date: Wed, 24 Jul 2024 11:57:42 -0700 Subject: [PATCH] refactoring --- src/core/api.c | 5 ++++- src/core/datagram.c | 1 + src/core/operation.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/api.c b/src/core/api.c index f18a7f106c..6a14709780 100644 --- a/src/core/api.c +++ b/src/core/api.c @@ -796,6 +796,8 @@ MsQuicStreamStart( QUIC_STATUS Status; QUIC_STREAM* Stream; QUIC_CONNECTION* Connection; + BOOLEAN IsPriority = !!(Flags & QUIC_STREAM_START_FLAG_PRIORITY_WORK); + Flags &= ~QUIC_STREAM_START_FLAG_PRIORITY_WORK; QuicTraceEvent( ApiEnter, @@ -853,7 +855,7 @@ MsQuicStreamStart( // // Queue the operation but don't wait for the completion. // - if (Flags & QUIC_STREAM_START_FLAG_PRIORITY_WORK) { + if (IsPriority) { QuicConnQueuePriorityOper(Connection, Oper); } else { QuicConnQueueOper(Connection, Oper); @@ -1009,6 +1011,7 @@ MsQuicStreamSend( QUIC_SEND_REQUEST* SendRequest; BOOLEAN QueueOper = TRUE; const BOOLEAN IsPriority = !!(Flags & QUIC_SEND_FLAG_PRIORITY_WORK); + Flags &= ~QUIC_SEND_FLAG_PRIORITY_WORK; BOOLEAN SendInline; QUIC_OPERATION* Oper; diff --git a/src/core/datagram.c b/src/core/datagram.c index 0d794d85a5..3ed81e95fc 100644 --- a/src/core/datagram.c +++ b/src/core/datagram.c @@ -328,6 +328,7 @@ QuicDatagramQueueSend( QUIC_STATUS Status; BOOLEAN QueueOper = TRUE; const BOOLEAN IsPriority = !!(SendRequest->Flags & QUIC_SEND_FLAG_PRIORITY_WORK); + SendRequest->Flags &= ~QUIC_SEND_FLAG_PRIORITY_WORK; QUIC_CONNECTION* Connection = QuicDatagramGetConnection(Datagram); CxPlatDispatchLockAcquire(&Datagram->ApiQueueLock); diff --git a/src/core/operation.c b/src/core/operation.c index 96f1bfcc86..21c96f4bf2 100644 --- a/src/core/operation.c +++ b/src/core/operation.c @@ -163,7 +163,7 @@ QuicOperationEnqueuePriority( #if DEBUG CXPLAT_DBG_ASSERT(Oper->Link.Flink == NULL); #endif - StartProcessing = CxPlatListIsEmpty(&OperQ->List) && !OperQ->ActivelyProcessing; + StartProcessing = (&OperQ->List.Flink == OperQ->PriorityTail) && !OperQ->ActivelyProcessing; CxPlatListInsertTail(*OperQ->PriorityTail, &Oper->Link); OperQ->PriorityTail = &Oper->Link.Flink; CxPlatDispatchLockRelease(&OperQ->Lock);