mirror of
https://github.com/espressif/openthread.git
synced 2026-10-09 01:07:39 +00:00
Fix bugs in Announce (#1471)
This commit is contained in:
@@ -589,7 +589,7 @@ ThreadError otThreadSetEnabled(otInstance *aInstance, bool aEnabled)
|
|||||||
{
|
{
|
||||||
VerifyOrExit(aInstance->mThreadNetif.GetMac().GetPanId() != Mac::kPanIdBroadcast,
|
VerifyOrExit(aInstance->mThreadNetif.GetMac().GetPanId() != Mac::kPanIdBroadcast,
|
||||||
error = kThreadError_InvalidState);
|
error = kThreadError_InvalidState);
|
||||||
error = aInstance->mThreadNetif.GetMle().Start(true);
|
error = aInstance->mThreadNetif.GetMle().Start(true, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+6
-10
@@ -202,7 +202,7 @@ exit:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadError Mle::Start(bool aEnableReattach)
|
ThreadError Mle::Start(bool aEnableReattach, bool aAnnounceAttach)
|
||||||
{
|
{
|
||||||
ThreadError error = kThreadError_None;
|
ThreadError error = kThreadError_None;
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ ThreadError Mle::Start(bool aEnableReattach)
|
|||||||
mReattachState = kReattachStart;
|
mReattachState = kReattachStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetRloc16() == Mac::kShortAddrInvalid)
|
if (aAnnounceAttach || (GetRloc16() == Mac::kShortAddrInvalid))
|
||||||
{
|
{
|
||||||
BecomeChild(kMleAttachAnyPartition);
|
BecomeChild(kMleAttachAnyPartition);
|
||||||
}
|
}
|
||||||
@@ -562,7 +562,9 @@ ThreadError Mle::SetStateChild(uint16_t aRloc16)
|
|||||||
mNetif.GetIp6().SetForwardingEnabled(false);
|
mNetif.GetIp6().SetForwardingEnabled(false);
|
||||||
mNetif.GetIp6().mMpl.SetTimerExpirations(kMplChildDataMessageTimerExpirations);
|
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;
|
mPreviousPanId = Mac::kPanIdBroadcast;
|
||||||
mNetif.GetAnnounceBeginServer().SendAnnounce(1 << mPreviousChannel);
|
mNetif.GetAnnounceBeginServer().SendAnnounce(1 << mPreviousChannel);
|
||||||
@@ -2448,12 +2450,6 @@ ThreadError Mle::HandleLeaderData(const Message &aMessage, const Ip6::MessageInf
|
|||||||
mNetif.GetPendingDataset().Clear(false);
|
mNetif.GetPendingDataset().Clear(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mPreviousPanId != Mac::kPanIdBroadcast && ((mDeviceMode & ModeTlv::kModeFFD) == 0))
|
|
||||||
{
|
|
||||||
mPreviousPanId = Mac::kPanIdBroadcast;
|
|
||||||
mNetif.GetAnnounceBeginServer().SendAnnounce(1 << mPreviousChannel);
|
|
||||||
}
|
|
||||||
|
|
||||||
mRetrieveNewNetworkData = false;
|
mRetrieveNewNetworkData = false;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
@@ -2993,7 +2989,7 @@ ThreadError Mle::HandleAnnounce(const Message &aMessage, const Ip6::MessageInfo
|
|||||||
mPreviousPanId = mNetif.GetMac().GetPanId();
|
mPreviousPanId = mNetif.GetMac().GetPanId();
|
||||||
mNetif.GetMac().SetChannel(static_cast<uint8_t>(channel.GetChannel()));
|
mNetif.GetMac().SetChannel(static_cast<uint8_t>(channel.GetChannel()));
|
||||||
mNetif.GetMac().SetPanId(panid.GetPanId());
|
mNetif.GetMac().SetPanId(panid.GetPanId());
|
||||||
Start(false);
|
Start(false, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -488,13 +488,15 @@ public:
|
|||||||
/**
|
/**
|
||||||
* This method starts the MLE protocol operation.
|
* 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_None Successfully started the protocol operation.
|
||||||
* @retval kThreadError_Already The protocol operation was already started.
|
* @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.
|
* This method stops the MLE protocol operation.
|
||||||
|
|||||||
Reference in New Issue
Block a user