mirror of
https://github.com/espressif/openthread.git
synced 2026-08-31 22:39:54 +00:00
[indirect-sender] remove existing supervision msg on new msg add (#5638)
This commit is contained in:
@@ -102,6 +102,16 @@ void IndirectSender::AddMessageForSleepyChild(Message &aMessage, Child &aChild)
|
||||
aMessage.SetChildMask(childIndex);
|
||||
mSourceMatchController.IncrementMessageCount(aChild);
|
||||
|
||||
if ((aMessage.GetType() != Message::kTypeSupervision) && (aChild.GetIndirectMessageCount() > 1))
|
||||
{
|
||||
Message *supervisionMessage = FindIndirectMessage(aChild, /* aSupervisionTypeOnly */ true);
|
||||
|
||||
if (supervisionMessage != nullptr)
|
||||
{
|
||||
IgnoreError(RemoveMessageFromSleepyChild(*supervisionMessage, aChild));
|
||||
}
|
||||
}
|
||||
|
||||
RequestMessageUpdate(aChild);
|
||||
|
||||
exit:
|
||||
@@ -211,30 +221,16 @@ void IndirectSender::HandleChildModeChange(Child &aChild, Mle::DeviceMode aOldMo
|
||||
// case.
|
||||
}
|
||||
|
||||
Message *IndirectSender::FindIndirectMessage(Child &aChild)
|
||||
Message *IndirectSender::FindIndirectMessage(Child &aChild, bool aSupervisionTypeOnly)
|
||||
{
|
||||
Message *message;
|
||||
Message *next;
|
||||
uint16_t childIndex = Get<ChildTable>().GetChildIndex(aChild);
|
||||
|
||||
for (message = Get<MeshForwarder>().mSendQueue.GetHead(); message; message = next)
|
||||
for (message = Get<MeshForwarder>().mSendQueue.GetHead(); message; message = message->GetNext())
|
||||
{
|
||||
next = message->GetNext();
|
||||
|
||||
if (message->GetChildMask(childIndex))
|
||||
if (message->GetChildMask(childIndex) &&
|
||||
(!aSupervisionTypeOnly || (message->GetType() == Message::kTypeSupervision)))
|
||||
{
|
||||
// Skip and remove the supervision message if there are
|
||||
// other messages queued for the child.
|
||||
|
||||
if ((message->GetType() == Message::kTypeSupervision) && (aChild.GetIndirectMessageCount() > 1))
|
||||
{
|
||||
message->ClearChildMask(childIndex);
|
||||
mSourceMatchController.DecrementMessageCount(aChild);
|
||||
Get<MeshForwarder>().mSendQueue.Dequeue(*message);
|
||||
message->Free();
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ private:
|
||||
void HandleFrameChangeDone(Child &aChild);
|
||||
|
||||
void UpdateIndirectMessage(Child &aChild);
|
||||
Message *FindIndirectMessage(Child &aChild);
|
||||
Message *FindIndirectMessage(Child &aChild, bool aSupervisionTypeOnly = false);
|
||||
void RequestMessageUpdate(Child &aChild);
|
||||
uint16_t PrepareDataFrame(Mac::TxFrame &aFrame, Child &aChild, Message &aMessage);
|
||||
void PrepareEmptyFrame(Mac::TxFrame &aFrame, Child &aChild, bool aAckRequest);
|
||||
|
||||
Reference in New Issue
Block a user