File tree Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -1093,15 +1093,7 @@ QuicConnAddRef(
10931093 UNREFERENCED_PARAMETER (Ref );
10941094#endif
10951095
1096- if (!Connection -> State .CleanupStarted ) {
1097- CxPlatRefIncrement (& Connection -> RefCount );
1098- } else {
1099- //
1100- // When the connection is in the cleanup state, the only caller allowed
1101- // to touch it is a worker thread.
1102- //
1103- CXPLAT_DBG_ASSERT (Ref == QUIC_CONN_REF_WORKER );
1104- }
1096+ CxPlatRefIncrement (& Connection -> RefCount );
11051097}
11061098
11071099//
@@ -1142,6 +1134,13 @@ QuicConnRelease(
11421134 CXPLAT_DBG_ASSERT (Connection -> Worker != NULL );
11431135 QuicWorkerQueueConnection (Connection -> Worker , Connection );
11441136 } else {
1137+ if (Connection -> State .CleanupStarted ) {
1138+ //
1139+ // When the connection is in the cleanup state, the only caller
1140+ // allowed to free it is a worker thread.
1141+ //
1142+ CXPLAT_DBG_ASSERT (Ref == QUIC_CONN_REF_WORKER );
1143+ }
11451144 QuicConnFree (Connection );
11461145 }
11471146 }
Original file line number Diff line number Diff line change @@ -271,7 +271,19 @@ QuicWorkerQueueConnection(
271271 "[conn][%p] Scheduling: %u" ,
272272 Connection ,
273273 QUIC_SCHEDULE_QUEUED );
274- QuicConnAddRef (Connection , QUIC_CONN_REF_WORKER );
274+ if (Connection -> State .CleanupStarted ) {
275+ #if DEBUG
276+ //
277+ // If the Connection is in the CleanupStarted state, its ref count
278+ // is zero and it is queued here for freeing.
279+ // Only increment the detailed ref count in debug builds.
280+ // Just don't increment the main ref count in this state.
281+ //
282+ CxPlatRefIncrement (& Connection -> RefTypeBiasedCount [QUIC_CONN_REF_WORKER ]);
283+ #endif
284+ } else {
285+ QuicConnAddRef (Connection , QUIC_CONN_REF_WORKER );
286+ }
275287 CxPlatListInsertTail (& Worker -> Connections , & Connection -> WorkerLink );
276288 ConnectionQueued = TRUE;
277289 }
You can’t perform that action at this time.
0 commit comments