[mle] skip saving network info on role change to detached (#3553)

This commit changes the behavior of `Mle` to skip the saving of
network info (to non-volatile memory) on role change to detached. Note
that `Store()` does only update the MAC/MLE counters if device is not
attached. The MAC/MLE counters update is tracked already by
`KeyManager`.
This commit is contained in:
Abtin Keshavarzian
2019-02-04 21:07:54 -08:00
committed by Jonathan Hui
parent e990ede832
commit ab871b5025
+7 -1
View File
@@ -1522,7 +1522,13 @@ void Mle::HandleStateChanged(otChangedFlags aFlags)
if (aFlags & (OT_CHANGED_THREAD_ROLE | OT_CHANGED_THREAD_KEY_SEQUENCE_COUNTER))
{
Store();
// Store the settings on a key seq change, or when role changes and device
// is attached (i.e., skip `Store()` on role change to detached).
if ((aFlags & OT_CHANGED_THREAD_KEY_SEQUENCE_COUNTER) || IsAttached())
{
Store();
}
}
if (aFlags & OT_CHANGED_SECURITY_POLICY)