Fix bugs in Announce (#1471)

This commit is contained in:
rongli
2017-03-16 09:04:51 -07:00
committed by Jonathan Hui
parent 90bab8312b
commit 9a175befed
3 changed files with 11 additions and 13 deletions
+1 -1
View File
@@ -589,7 +589,7 @@ ThreadError otThreadSetEnabled(otInstance *aInstance, bool aEnabled)
{
VerifyOrExit(aInstance->mThreadNetif.GetMac().GetPanId() != Mac::kPanIdBroadcast,
error = kThreadError_InvalidState);
error = aInstance->mThreadNetif.GetMle().Start(true);
error = aInstance->mThreadNetif.GetMle().Start(true, false);
}
else
{
+6 -10
View File
@@ -202,7 +202,7 @@ exit:
return error;
}
ThreadError Mle::Start(bool aEnableReattach)
ThreadError Mle::Start(bool aEnableReattach, bool aAnnounceAttach)
{
ThreadError error = kThreadError_None;
@@ -223,7 +223,7 @@ ThreadError Mle::Start(bool aEnableReattach)
mReattachState = kReattachStart;
}
if (GetRloc16() == Mac::kShortAddrInvalid)
if (aAnnounceAttach || (GetRloc16() == Mac::kShortAddrInvalid))
{
BecomeChild(kMleAttachAnyPartition);
}
@@ -562,7 +562,9 @@ ThreadError Mle::SetStateChild(uint16_t aRloc16)
mNetif.GetIp6().SetForwardingEnabled(false);
mNetif.GetIp6().mMpl.SetTimerExpirations(kMplChildDataMessageTimerExpirations);
if (mPreviousPanId != Mac::kPanIdBroadcast && (mDeviceMode & ModeTlv::kModeFFD))
// Once the Thread device receives the new Active Commissioning Dataset, the device MUST
// transmit its own Announce messages on the channel it was on prior to the attachment.
if (mPreviousPanId != Mac::kPanIdBroadcast)
{
mPreviousPanId = Mac::kPanIdBroadcast;
mNetif.GetAnnounceBeginServer().SendAnnounce(1 << mPreviousChannel);
@@ -2448,12 +2450,6 @@ ThreadError Mle::HandleLeaderData(const Message &aMessage, const Ip6::MessageInf
mNetif.GetPendingDataset().Clear(false);
}
if (mPreviousPanId != Mac::kPanIdBroadcast && ((mDeviceMode & ModeTlv::kModeFFD) == 0))
{
mPreviousPanId = Mac::kPanIdBroadcast;
mNetif.GetAnnounceBeginServer().SendAnnounce(1 << mPreviousChannel);
}
mRetrieveNewNetworkData = false;
exit:
@@ -2993,7 +2989,7 @@ ThreadError Mle::HandleAnnounce(const Message &aMessage, const Ip6::MessageInfo
mPreviousPanId = mNetif.GetMac().GetPanId();
mNetif.GetMac().SetChannel(static_cast<uint8_t>(channel.GetChannel()));
mNetif.GetMac().SetPanId(panid.GetPanId());
Start(false);
Start(false, true);
}
else
{
+4 -2
View File
@@ -488,13 +488,15 @@ public:
/**
* This method starts the MLE protocol operation.
*
* @param[in] aEnableReattach True to enable reattach process using stored dataset, False not.
* @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.
*
* @retval kThreadError_None Successfully started the protocol operation.
* @retval kThreadError_Already The protocol operation was already started.
*
*/
ThreadError Start(bool aEnableReattach);
ThreadError Start(bool aEnableReattach, bool aAnnounceAttach);
/**
* This method stops the MLE protocol operation.