From 1bb82c54ecef747796472ed59148a4c8b2c60262 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Mon, 29 Aug 2016 11:34:15 -0700 Subject: [PATCH] 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. --- src/core/common/timer.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/core/common/timer.cpp b/src/core/common/timer.cpp index 35536a8a5..eb64990d9 100644 --- a/src/core/common/timer.cpp +++ b/src/core/common/timer.cpp @@ -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)