fix(timers): Fixes multiple issue with timer wheel (#705)
* Fixed an issue where a timer truncated the link list. * Fixed an issue where a timer stopped and started itself within an OnTick causing it to remove itself from the link list, but still think it's running.
This commit is contained in:
parent
c2f853d8a8
commit
1d916fe2df
4 changed files with 68 additions and 71 deletions
|
|
@ -81,6 +81,7 @@ namespace Server
|
|||
return this;
|
||||
}
|
||||
|
||||
Index = 0;
|
||||
Running = true;
|
||||
AddTimer(this, (long)Delay.TotalMilliseconds);
|
||||
|
||||
|
|
@ -101,8 +102,15 @@ namespace Server
|
|||
return;
|
||||
}
|
||||
|
||||
RemoveTimer(this);
|
||||
// We are at the head
|
||||
if (_rings[_ring][_slot] == this)
|
||||
{
|
||||
_rings[_ring][_slot] = _nextTimer;
|
||||
}
|
||||
|
||||
Detach();
|
||||
Running = false;
|
||||
Version++;
|
||||
var prof = GetProfile();
|
||||
|
||||
if (prof != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue