55
66--*/
77
8+ typedef enum QUIC_CONFIGURATION_REF {
9+
10+ QUIC_CONF_REF_HANDLE , // The handle provided to the app.
11+ QUIC_CONF_REF_CONNECTION , // Per connection using this Configuration.
12+ QUIC_CONF_REF_LOAD_CRED , // During async credential loading.
13+ QUIC_CONF_REF_OPERATION , // Per queued operation.
14+
15+ QUIC_CONF_REF_COUNT
16+ } QUIC_CONFIGURATION_REF ;
17+
818//
919// Represents a set of TLS and QUIC configurations and settings.
1020//
@@ -31,6 +41,13 @@ typedef struct QUIC_CONFIGURATION {
3141 //
3242 CXPLAT_REF_COUNT RefCount ;
3343
44+ #if DEBUG
45+ //
46+ // Detailed Reference count.
47+ //
48+ uint16_t RefTypeCount [QUIC_CONF_REF_COUNT ];
49+ #endif
50+
3451 //
3552 // The TLS security configurations.
3653 //
@@ -106,9 +123,15 @@ QuicConfigurationUninitialize(
106123QUIC_INLINE
107124void
108125QuicConfigurationAddRef (
109- _In_ QUIC_CONFIGURATION * Configuration
126+ _In_ QUIC_CONFIGURATION * Configuration ,
127+ _In_ QUIC_CONFIGURATION_REF Ref
110128 )
111129{
130+ #if DEBUG
131+ InterlockedIncrement16 ((volatile short * )& Configuration -> RefTypeCount [Ref ]);
132+ #else
133+ UNREFERENCED_PARAMETER (Ref );
134+ #endif
112135 CxPlatRefIncrement (& Configuration -> RefCount );
113136}
114137
@@ -118,9 +141,17 @@ QuicConfigurationAddRef(
118141QUIC_INLINE
119142void
120143QuicConfigurationRelease (
121- _In_ QUIC_CONFIGURATION * Configuration
144+ _In_ QUIC_CONFIGURATION * Configuration ,
145+ _In_ QUIC_CONFIGURATION_REF Ref
122146 )
123147{
148+ #if DEBUG
149+ CXPLAT_TEL_ASSERT (Configuration -> RefTypeCount [Ref ] > 0 );
150+ uint16_t Result = (uint16_t )InterlockedDecrement16 ((volatile short * )& Configuration -> RefTypeCount [Ref ]);
151+ CXPLAT_TEL_ASSERT (Result != 0xFFFF );
152+ #else
153+ UNREFERENCED_PARAMETER (Ref );
154+ #endif
124155 if (CxPlatRefDecrement (& Configuration -> RefCount )) {
125156 QuicConfigurationUninitialize (Configuration );
126157 }
0 commit comments