Fix race that would allow GetDateHeaderValues to return null
This commit is contained in:
parent
d164f350b4
commit
cb284b9d58
|
|
@ -58,9 +58,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
||||||
/// <returns>The value in string and byte[] format.</returns>
|
/// <returns>The value in string and byte[] format.</returns>
|
||||||
public DateHeaderValues GetDateHeaderValues()
|
public DateHeaderValues GetDateHeaderValues()
|
||||||
{
|
{
|
||||||
if (!_hadRequestsSinceLastTimerTick)
|
_hadRequestsSinceLastTimerTick = !_isDisposed;
|
||||||
|
|
||||||
|
if (!_timerIsRunning)
|
||||||
{
|
{
|
||||||
PrepareDateValues();
|
StartTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
return _dateValues;
|
return _dateValues;
|
||||||
|
|
@ -151,18 +153,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Starts the timer if it's turned off, or sets the datevalues to the current time if disposed.
|
|
||||||
/// </summary>
|
|
||||||
private void PrepareDateValues()
|
|
||||||
{
|
|
||||||
_hadRequestsSinceLastTimerTick = !_isDisposed;
|
|
||||||
if (!_timerIsRunning)
|
|
||||||
{
|
|
||||||
StartTimer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets date values from a provided ticks value
|
/// Sets date values from a provided ticks value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue