mirror of
https://github.com/espressif/openthread.git
synced 2026-09-12 20:20:04 +00:00
[mle] centralize ChildUpdate reject response logic (#12066)
Introduces a new private method `Mle::SendChildUpdateRejectResponse()` to consolidate the logic for sending a reject response to a "Child Update Request". This new method creates a response containing the Source Address TLV, Status TLV, and (if applicable) Response TLV. The new method is now used in `Mle::HandleChildUpdateRequestOnChild()` when the device is not a parent of the sender, and in `Mle::HandleChildUpdateRequestOnParent()` when a request from an unknown child is received. This change removes duplicated code from both locations.
This commit is contained in:
@@ -2255,8 +2255,7 @@ void Mle::HandleChildUpdateRequestOnParent(RxInfo &aRxInfo)
|
||||
// Status TLV (error).
|
||||
if (mode.IsRxOnWhenIdle())
|
||||
{
|
||||
tlvList.Add(Tlv::kStatus);
|
||||
SendChildUpdateResponseToChild(nullptr, aRxInfo.mMessageInfo, tlvList, challenge);
|
||||
IgnoreError(SendChildUpdateRejectResponse(challenge, aRxInfo.mMessageInfo.GetPeerAddr()));
|
||||
}
|
||||
|
||||
ExitNow();
|
||||
|
||||
Reference in New Issue
Block a user