mirror of
https://github.com/espressif/openthread.git
synced 2026-08-09 12:17:47 +00:00
Fix bug in starting a timer. (#487)
This fixes an issue where calling Start() on a running timer could lead to out-of-order timers. This fix always removes the timer from the list then adds it back after the timer values have been updated.
This commit is contained in:
@@ -42,7 +42,7 @@ static Timer *sTail = NULL;
|
||||
|
||||
void TimerScheduler::Add(Timer &aTimer)
|
||||
{
|
||||
VerifyOrExit(aTimer.mNext == NULL && sTail != &aTimer, ;);
|
||||
Remove(aTimer);
|
||||
|
||||
if (sHead == NULL)
|
||||
{
|
||||
@@ -83,9 +83,6 @@ void TimerScheduler::Add(Timer &aTimer)
|
||||
sTail = &aTimer;
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
void TimerScheduler::Remove(Timer &aTimer)
|
||||
|
||||
Reference in New Issue
Block a user