mirror of
https://github.com/espressif/openthread.git
synced 2026-08-10 12:47:47 +00:00
[mle] change Restore() to return void (#7537)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user