mirror of
https://github.com/espressif/openthread.git
synced 2026-09-08 10:10:06 +00:00
Update source match table when switching from extended to short mode. (#1456)
This commit is contained in:
@@ -424,6 +424,25 @@ void MeshForwarder::ClearSrcMatchEntry(Child &aChild)
|
||||
}
|
||||
}
|
||||
|
||||
void MeshForwarder::SetSrcMatchAsShort(Child &aChild, bool aShortSource)
|
||||
{
|
||||
VerifyOrExit(aChild.mAddSrcMatchEntryShort != aShortSource, ;);
|
||||
|
||||
if (aChild.mQueuedIndirectMessageCnt > 0)
|
||||
{
|
||||
ClearSrcMatchEntry(aChild);
|
||||
aChild.mAddSrcMatchEntryShort = aShortSource;
|
||||
AddSrcMatchEntry(aChild);
|
||||
}
|
||||
else
|
||||
{
|
||||
aChild.mAddSrcMatchEntryShort = aShortSource;
|
||||
}
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadError MeshForwarder::SendMessage(Message &aMessage)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
@@ -1835,7 +1854,7 @@ void MeshForwarder::HandleReceivedFrame(Mac::Frame &aFrame)
|
||||
if (((child->mMode & Mle::ModeTlv::kModeRxOnWhenIdle) == 0) &&
|
||||
macSource.mLength == sizeof(otShortAddress))
|
||||
{
|
||||
child->mAddSrcMatchEntryShort = true;
|
||||
SetSrcMatchAsShort(*child, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -225,6 +225,15 @@ public:
|
||||
*/
|
||||
void UpdateIndirectMessages(void);
|
||||
|
||||
/**
|
||||
* This method sets whether or not to perform source matching on the extended or short address for Frame Pending determination.
|
||||
*
|
||||
* @param[in] aChild A reference to the child.
|
||||
* @param[in] aMatchShort TRUE to match on short source address, FALSE otherwise.
|
||||
*
|
||||
*/
|
||||
void SetSrcMatchAsShort(Child &aChild, bool aMatchShort);
|
||||
|
||||
/**
|
||||
* This method returns a reference to the send queue.
|
||||
*
|
||||
|
||||
@@ -2264,7 +2264,7 @@ ThreadError MleRouter::HandleChildUpdateRequest(const Message &aMessage, const I
|
||||
}
|
||||
|
||||
child->mLastHeard = Timer::GetNow();
|
||||
child->mAddSrcMatchEntryShort = true;
|
||||
mNetif.GetMeshForwarder().SetSrcMatchAsShort(*child, true);
|
||||
|
||||
SendChildUpdateResponse(child, aMessageInfo, tlvs, tlvslength, &challenge);
|
||||
|
||||
@@ -2355,7 +2355,7 @@ ThreadError MleRouter::HandleChildUpdateResponse(const Message &aMessage, const
|
||||
child->mLastHeard = Timer::GetNow();
|
||||
child->mKeySequence = aKeySequence;
|
||||
child->mLinkInfo.AddRss(mNetif.GetMac().GetNoiseFloor(), threadMessageInfo->mRss);
|
||||
child->mAddSrcMatchEntryShort = true;
|
||||
mNetif.GetMeshForwarder().SetSrcMatchAsShort(*child, true);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
@@ -3411,8 +3411,8 @@ ThreadError MleRouter::RestoreChildren(void)
|
||||
(childInfo.mFullFunction ? ModeTlv::kModeFFD : 0) |
|
||||
(childInfo.mFullNetworkData ? ModeTlv::kModeFullNetworkData : 0);
|
||||
child->mState = Neighbor::kStateRestored;
|
||||
child->mAddSrcMatchEntryShort = true;
|
||||
child->mLastHeard = Timer::GetNow();
|
||||
mNetif.GetMeshForwarder().SetSrcMatchAsShort(*child, true);
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
Reference in New Issue
Block a user