[mle] change Restore() to return void (#7537)

This commit is contained in:
Abtin Keshavarzian
2022-03-28 21:07:34 -07:00
committed by GitHub
parent 3be955b28b
commit 2b2534cc76
3 changed files with 8 additions and 14 deletions
+1 -1
View File
@@ -189,7 +189,7 @@ void Instance::AfterInit(void)
// Restore datasets and network information
Get<Settings>().Init();
IgnoreError(Get<Mle::MleRouter>().Restore());
Get<Mle::MleRouter>().Restore();
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
Get<Trel::Link>().AfterInit();
+5 -8
View File
@@ -310,9 +310,8 @@ exit:
return;
}
Error Mle::Restore(void)
void Mle::Restore(void)
{
Error error = kErrorNone;
Settings::NetworkInfo networkInfo;
Settings::ParentInfo parentInfo;
@@ -323,7 +322,7 @@ Error Mle::Restore(void)
Get<DuaManager>().Restore();
#endif
SuccessOrExit(error = Get<Settings>().Read(networkInfo));
SuccessOrExit(Get<Settings>().Read(networkInfo));
Get<KeyManager>().SetCurrentKeySequence(networkInfo.GetKeySequence());
Get<KeyManager>().SetMleFrameCounter(networkInfo.GetMleFrameCounter());
@@ -356,9 +355,7 @@ Error Mle::Restore(void)
if (!IsActiveRouter(networkInfo.GetRloc16()))
{
error = Get<Settings>().Read(parentInfo);
if (error != kErrorNone)
if (Get<Settings>().Read(parentInfo) != kErrorNone)
{
// If the restored RLOC16 corresponds to an end-device, it
// is expected that the `ParentInfo` settings to be valid
@@ -390,11 +387,11 @@ Error Mle::Restore(void)
}
#endif
// Sucessfully restored the network information from non-volatile settings after boot.
// Successfully restored the network information from non-volatile settings after boot.
mHasRestored = true;
exit:
return error;
return;
}
Error Mle::Store(void)
+2 -5
View File
@@ -144,13 +144,10 @@ public:
void Stop(void) { Stop(kUpdateNetworkDatasets); }
/**
* This method restores network information from non-volatile memory.
*
* @retval kErrorNone Successfully restore the network information.
* @retval kErrorNotFound There is no valid network information stored in non-volatile memory.
* This method restores network information from non-volatile memory (if any).
*
*/
Error Restore(void);
void Restore(void);
/**
* This method stores network information into non-volatile memory.