[mle] stop attach timer from SetStateChild() (#3538)

This commit changes `SetStateChild()` to stop `mAttachTimer`. This
ensures that as the `mAttachState` is set to idle, the attach timer is
also stopped (note that the attach timer callback asserts on idle
attach state). This addresses a rare issue where an inopportune device
mode change request on an already attached device while it is
performing periodic parent search (or possibly delaying processing of
a received announce) could cause an assert; `SetDeviceMode()` would
call `SetStateChild()` setting the attach state to idle while attach
timer would continue to run.
This commit is contained in:
Abtin Keshavarzian
2019-01-31 13:03:02 -08:00
committed by Jonathan Hui
parent 987ff3c017
commit 57e2f4e26d
+1
View File
@@ -737,6 +737,7 @@ void Mle::SetStateChild(uint16_t aRloc16)
SetRloc16(aRloc16);
SetRole(OT_DEVICE_ROLE_CHILD);
SetAttachState(kAttachStateIdle);
mAttachTimer.Stop();
mAttachCounter = 0;
mReattachState = kReattachStop;
mChildUpdateAttempts = 0;