mirror of
https://github.com/espressif/openthread.git
synced 2026-08-11 21:27:46 +00:00
[mle] add mHasRestored flag (#5228)
This commit introduces the mHasRestored flag and a common HasRestored() method as devices may decide to introduce some jitter/randomization to avoid the burst of traffic in cases a bunch of devices nearby resets/reboots together.
This commit is contained in:
@@ -86,6 +86,7 @@ Mle::Mle(Instance &aInstance)
|
||||
, mDataRequestAttempts(0)
|
||||
, mDataRequestState(kDataRequestNone)
|
||||
, mAddressRegistrationMode(kAppendAllAddresses)
|
||||
, mHasRestored(false)
|
||||
, mParentLinkMargin(0)
|
||||
, mParentIsSingleton(false)
|
||||
, mReceivedResponseFromParent(false)
|
||||
@@ -439,6 +440,9 @@ otError Mle::Restore(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Sucessfully restored the network information from non-volatile settings after boot.
|
||||
mHasRestored = true;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -915,6 +915,16 @@ public:
|
||||
*/
|
||||
otError GetLocatorAddress(Ip6::Address &aAddress, uint16_t aLocator) const;
|
||||
|
||||
/**
|
||||
* This method indicates whether or not the device has restored the network information from
|
||||
* non-volatile settings after boot.
|
||||
*
|
||||
* @retval true Sucessfully restored the network information.
|
||||
* @retval false No valid network information was found.
|
||||
*
|
||||
*/
|
||||
bool HasRestored(void) const { return mHasRestored; }
|
||||
|
||||
protected:
|
||||
/**
|
||||
* States during attach (when searching for a parent).
|
||||
@@ -1734,6 +1744,7 @@ private:
|
||||
|
||||
AddressRegistrationMode mAddressRegistrationMode;
|
||||
|
||||
bool mHasRestored;
|
||||
uint8_t mParentLinkMargin;
|
||||
bool mParentIsSingleton;
|
||||
bool mReceivedResponseFromParent;
|
||||
|
||||
Reference in New Issue
Block a user