File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/Microsoft.AspNetCore.Server.Kestrel.Core/Internal Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -283,16 +283,19 @@ public void Tick(DateTimeOffset now)
283
283
{
284
284
if ( _readTimingEnabled )
285
285
{
286
+ // Reference in local var to avoid torn reads in case the min rate is changed via IHttpMinRequestBodyDataRateFeature
287
+ var minRequestBodyDataRate = _frame . MinRequestBodyDataRate ;
288
+
286
289
_readTimingElapsedTicks += timestamp - _lastTimestamp ;
287
290
288
- if ( _frame . MinRequestBodyDataRate ? . BytesPerSecond > 0 && _readTimingElapsedTicks > _frame . MinRequestBodyDataRate . GracePeriod . Ticks )
291
+ if ( minRequestBodyDataRate ? . BytesPerSecond > 0 && _readTimingElapsedTicks > minRequestBodyDataRate . GracePeriod . Ticks )
289
292
{
290
293
var elapsedSeconds = ( double ) _readTimingElapsedTicks / TimeSpan . TicksPerSecond ;
291
294
var rate = Interlocked . Read ( ref _readTimingBytesRead ) / elapsedSeconds ;
292
295
293
- if ( rate < _frame . MinRequestBodyDataRate . BytesPerSecond && ! Debugger . IsAttached )
296
+ if ( rate < minRequestBodyDataRate . BytesPerSecond && ! Debugger . IsAttached )
294
297
{
295
- Log . RequestBodyMininumDataRateNotSatisfied ( _context . ConnectionId , _frame . TraceIdentifier , _frame . MinRequestBodyDataRate . BytesPerSecond ) ;
298
+ Log . RequestBodyMininumDataRateNotSatisfied ( _context . ConnectionId , _frame . TraceIdentifier , minRequestBodyDataRate . BytesPerSecond ) ;
296
299
Timeout ( ) ;
297
300
}
298
301
}
You can’t perform that action at this time.
0 commit comments