Update source match table when switching from extended to short mode. (#1456)

This commit is contained in:
Jonathan Hui
2017-03-10 20:40:32 -08:00
committed by GitHub
parent 0d4da3a0f9
commit a09aecf88c
3 changed files with 32 additions and 4 deletions
+20 -1
View File
@@ -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);
}
}
+9
View File
@@ -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.
*
+3 -3
View File
@@ -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: