[mle] simplify Start() (#3472)

This commit simplifies the `Mle::Start()` by combining its parameters.
With the new definition `Start()` would always try to reattach using
any saved active/pending dataset unless it is asked to attach on an
announced network (i.e., `aAnnounceAttach` is `true`).
This commit is contained in:
Abtin Keshavarzian
2019-01-22 09:05:50 -08:00
committed by Jonathan Hui
parent f40f49ff32
commit 5e50914f1f
3 changed files with 5 additions and 6 deletions
+1 -1
View File
@@ -447,7 +447,7 @@ otError otThreadSetEnabled(otInstance *aInstance, bool aEnabled)
{
VerifyOrExit(instance.GetThreadNetif().GetMac().GetPanId() != Mac::kPanIdBroadcast,
error = OT_ERROR_INVALID_STATE);
error = instance.GetThreadNetif().GetMle().Start(true, false);
error = instance.GetThreadNetif().GetMle().Start(/* aAnnounceAttach */ false);
}
else
{
+3 -3
View File
@@ -236,7 +236,7 @@ exit:
return error;
}
otError Mle::Start(bool aEnableReattach, bool aAnnounceAttach)
otError Mle::Start(bool aAnnounceAttach)
{
ThreadNetif &netif = GetNetif();
otError error = OT_ERROR_NONE;
@@ -253,7 +253,7 @@ otError Mle::Start(bool aEnableReattach, bool aAnnounceAttach)
netif.GetKeyManager().Start();
if (aEnableReattach)
if (!aAnnounceAttach)
{
mReattachState = kReattachStart;
}
@@ -3658,7 +3658,7 @@ void Mle::ProcessAnnounce(void)
mac.SetPanChannel(newChannel);
mac.SetPanId(newPanId);
Start(/* aEnableReattach */ false, /* aAnnounceAttach */ true);
Start(/* aAnnounceAttach */ true);
}
otError Mle::HandleDiscoveryResponse(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
+1 -2
View File
@@ -495,7 +495,6 @@ public:
/**
* This method starts the MLE protocol operation.
*
* @param[in] aEnableReattach True if reattach using stored dataset, or False if not.
* @param[in] aAnnounceAttach True if attach on the announced thread network with newer active timestamp,
* or False if not.
*
@@ -503,7 +502,7 @@ public:
* @retval OT_ERROR_ALREADY The protocol operation was already started.
*
*/
otError Start(bool aEnableReattach, bool aAnnounceAttach);
otError Start(bool aAnnounceAttach);
/**
* This method stops the MLE protocol operation.