[nexus] fix duplicate alarm firing in simulation core (#12509)

This commit fixes an issue in the Nexus simulation core where alarms
could fire multiple times at the same simulation timestamp. This occurred
because the `mScheduled` flag was not cleared upon firing, and if the
simulation time remained static (e.g., due to pending tasklets), the
`ShouldTrigger` condition would remain true across multiple iterations
of the simulation loop.

By clearing the `mScheduled` flag before invoking the fired callback,
we ensure that each scheduled alarm triggers exactly once unless it is
explicitly rescheduled by the stack. This improvement stabilizes Nexus
tests (such as 6.2.2) that were previously flaky due to this
non-deterministic behavior.
This commit is contained in:
Jonathan Hui
2026-02-20 01:04:05 -06:00
committed by GitHub
parent c85ce4eec3
commit 790ac564ca
+1
View File
@@ -270,6 +270,7 @@ void Core::Process(Node &aNode)
if (aNode.mAlarm.ShouldTrigger(mNow))
{
aNode.mAlarm.mScheduled = false;
otPlatAlarmMilliFired(&aNode.GetInstance());
}
}