mirror of
https://github.com/espressif/openthread.git
synced 2026-09-05 08:40:06 +00:00
Schedule MLE Data Response messages to SEDs on network data change. (#946)
This commit is contained in:
@@ -1780,8 +1780,6 @@ void MeshForwarder::HandleDataRequest(const Mac::Address &aMacSource, const Thre
|
||||
child->mLastHeard = Timer::GetNow();
|
||||
child->mLinkFailures = 0;
|
||||
|
||||
mMle.HandleMacDataRequest(*child);
|
||||
|
||||
if (child->mQueuedIndirectMessageCnt > 0)
|
||||
{
|
||||
child->mDataRequest = true;
|
||||
|
||||
@@ -2276,6 +2276,35 @@ ThreadError MleRouter::HandleNetworkDataUpdateRouter(void)
|
||||
|
||||
SendDataResponse(destination, tlvs, sizeof(tlvs));
|
||||
|
||||
for (uint8_t i = 0; i < mMaxChildrenAllowed; i++)
|
||||
{
|
||||
Child *child = &mChildren[i];
|
||||
|
||||
if (child->mState != Neighbor::kStateValid || (child->mMode & ModeTlv::kModeRxOnWhenIdle) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.mFields.m16[0] = HostSwap16(0xfe80);
|
||||
destination.SetIid(child->mMacAddr);
|
||||
|
||||
if (child->mMode & ModeTlv::kModeFullNetworkData)
|
||||
{
|
||||
if (child->mNetworkDataVersion != mNetworkData.GetVersion())
|
||||
{
|
||||
SendDataResponse(destination, tlvs, sizeof(tlvs));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (child->mNetworkDataVersion != mNetworkData.GetStableVersion())
|
||||
{
|
||||
SendDataResponse(destination, tlvs, sizeof(tlvs));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
return kThreadError_None;
|
||||
}
|
||||
@@ -2859,36 +2888,6 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void MleRouter::HandleMacDataRequest(const Child &aChild)
|
||||
{
|
||||
static const uint8_t tlvs[] = {Tlv::kLeaderData, Tlv::kNetworkData};
|
||||
Ip6::Address destination;
|
||||
|
||||
VerifyOrExit(aChild.mState == Neighbor::kStateValid && (aChild.mMode & ModeTlv::kModeRxOnWhenIdle) == 0, ;);
|
||||
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.mFields.m16[0] = HostSwap16(0xfe80);
|
||||
destination.SetIid(aChild.mMacAddr);
|
||||
|
||||
if (aChild.mMode & ModeTlv::kModeFullNetworkData)
|
||||
{
|
||||
if (aChild.mNetworkDataVersion != mNetworkData.GetVersion())
|
||||
{
|
||||
SendDataResponse(destination, tlvs, sizeof(tlvs));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aChild.mNetworkDataVersion != mNetworkData.GetStableVersion())
|
||||
{
|
||||
SendDataResponse(destination, tlvs, sizeof(tlvs));
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
{}
|
||||
}
|
||||
|
||||
Router *MleRouter::GetRouters(uint8_t *aNumRouters)
|
||||
{
|
||||
if (aNumRouters != NULL)
|
||||
|
||||
@@ -559,14 +559,6 @@ public:
|
||||
*/
|
||||
ThreadError GetRouterInfo(uint16_t aRouterId, otRouterInfo &aRouterInfo);
|
||||
|
||||
/**
|
||||
* This method handles MAC Data Poll messages.
|
||||
*
|
||||
* @param[in] aChild The Child that sent the MAC Data Poll message.
|
||||
*
|
||||
*/
|
||||
void HandleMacDataRequest(const Child &aChild);
|
||||
|
||||
/**
|
||||
* This method indicates whether or not the given Thread partition attributes are preferred.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user