@@ -123,7 +123,7 @@ public Task InitializeAsync(IDnsServer dnsServer, string config)
123123 _config = AppConfig . Deserialize ( config )
124124 ?? throw new DnsClientException ( "Invalid application configuration." ) ;
125125
126- ConfigureStrategies ( ) ;
126+ ConfigureExport ( ) ;
127127
128128 // If no sinks exist, never enable logging.
129129 if ( ! _exportManager . HasStrategy ( ) )
@@ -161,16 +161,16 @@ public Task InsertLogAsync(DateTime timestamp, DnsDatagram request,
161161 {
162162 if ( _enableLogging )
163163 {
164- var entry = new LogEntry ( timestamp , remoteEP , protocol , request , response , _config ! . EnableEdnsLogging ) ;
164+ LogEntry entry = new LogEntry ( timestamp , remoteEP , protocol , request , response , _config ! . EnableEdnsLogging ) ;
165165
166166 if ( ! _channel . Writer . TryWrite ( entry ) )
167167 {
168168 Interlocked . Increment ( ref _droppedCount ) ;
169169
170- var now = DateTime . UtcNow ;
170+ DateTime now = DateTime . UtcNow ;
171171 if ( now - _lastDropLog >= DropLogInterval )
172172 {
173- var dropped = Interlocked . Exchange ( ref _droppedCount , 0 ) ;
173+ long dropped = Interlocked . Exchange ( ref _droppedCount , 0 ) ;
174174 _lastDropLog = now ;
175175 _dnsServer ? . WriteLog ( $ "Log export queue full; dropped { dropped } entries over last { DropLogInterval . TotalSeconds : F0} s.") ;
176176 }
@@ -187,14 +187,14 @@ public Task InsertLogAsync(DateTime timestamp, DnsDatagram request,
187187 private async Task BackgroundWorkerAsync ( CancellationToken token )
188188 {
189189 // ADR: Reuse this list buffer to avoid GC churn during high-volume logging.
190- var batch = new List < LogEntry > ( BULK_INSERT_COUNT ) ;
190+ List < LogEntry > batch = new List < LogEntry > ( BULK_INSERT_COUNT ) ;
191191
192192 try
193193 {
194194 while ( await _channel . Reader . WaitToReadAsync ( token ) . ConfigureAwait ( false ) )
195195 {
196196 while ( batch . Count < BULK_INSERT_COUNT &&
197- _channel . Reader . TryRead ( out var entry ) )
197+ _channel . Reader . TryRead ( out LogEntry ? entry ) )
198198 {
199199 if ( token . IsCancellationRequested )
200200 break ;
@@ -204,7 +204,7 @@ private async Task BackgroundWorkerAsync(CancellationToken token)
204204
205205 if ( batch . Count > 0 )
206206 {
207- await _exportManager . ImplementStrategyAsync ( batch , token ) . ConfigureAwait ( false ) ;
207+ await _exportManager . UseStrategyAsync ( batch , token ) . ConfigureAwait ( false ) ;
208208 batch . Clear ( ) ; // REUSE — do not reassign
209209 }
210210 }
@@ -220,7 +220,7 @@ private async Task BackgroundWorkerAsync(CancellationToken token)
220220 }
221221 }
222222
223- private void ConfigureStrategies ( )
223+ private void ConfigureExport ( )
224224 {
225225 _exportManager . RemoveStrategy ( typeof ( ConsoleExportStrategy ) ) ;
226226 if ( _config ! . ConsoleTarget != null && _config . ConsoleTarget . Enabled )
@@ -247,7 +247,7 @@ private async Task DrainRemainingLogs(List<LogEntry> batch, CancellationToken to
247247 {
248248 try
249249 {
250- while ( _channel ! . Reader . TryRead ( out var item ) )
250+ while ( _channel ! . Reader . TryRead ( out LogEntry ? item ) )
251251 {
252252 if ( token . IsCancellationRequested )
253253 break ;
@@ -256,14 +256,14 @@ private async Task DrainRemainingLogs(List<LogEntry> batch, CancellationToken to
256256
257257 if ( batch . Count >= BULK_INSERT_COUNT )
258258 {
259- await _exportManager . ImplementStrategyAsync ( batch , token ) . ConfigureAwait ( false ) ;
259+ await _exportManager . UseStrategyAsync ( batch , token ) . ConfigureAwait ( false ) ;
260260 batch . Clear ( ) ; // reuse instead of creating new list
261261 }
262262 }
263263
264264 if ( batch . Count > 0 && ! token . IsCancellationRequested )
265265 {
266- await _exportManager . ImplementStrategyAsync ( batch , token ) . ConfigureAwait ( false ) ;
266+ await _exportManager . UseStrategyAsync ( batch , token ) . ConfigureAwait ( false ) ;
267267 batch . Clear ( ) ;
268268 }
269269 }
0 commit comments