fix: Fixes fastwalk (#1377)

This commit is contained in:
Kamron Batman 2023-03-20 21:12:33 -07:00 committed by GitHub
parent 6daf536c28
commit a55b213393
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,17 +39,21 @@ public partial class NetState
var now = Core.TickCount; var now = Core.TickCount;
var lastIndex = -1;
// Expire old steps // Expire old steps
while (_expiredIndex != _stepIndex) while (_expiredIndex != _stepIndex)
{ {
var step = _steps[_expiredIndex]; var step = _steps[_expiredIndex];
// Is the step ahead of us, or the next step rolled over and we didn't yet // Is the step ahead of us, or the next step rolled over and we didn't yet
if (step - now > 0) if (step - now > 0 || lastIndex > -1 && _steps[lastIndex] > step)
{ {
break; break;
} }
lastIndex = _expiredIndex++;
if (_expiredIndex == stepsLength) if (_expiredIndex == stepsLength)
{ {
_expiredIndex -= stepsLength; _expiredIndex -= stepsLength;