[mle] log handling parent request failures (#5355)

This commit adds a few logs when handling MLE Parent Request, so that
when a child failed to receive a response, the logs can tell what
happened.
This commit is contained in:
Yakun Xu
2020-08-11 10:22:57 -07:00
committed by GitHub
parent 66dcbac15d
commit b5e17e07ee
+8 -3
View File
@@ -1675,7 +1675,7 @@ void MleRouter::HandleParentRequest(const Message &aMessage, const Ip6::MessageI
if (child == nullptr)
{
VerifyOrExit((child = mChildTable.GetNewChild()) != nullptr, OT_NOOP);
VerifyOrExit((child = mChildTable.GetNewChild()) != nullptr, error = OT_ERROR_NO_BUFS);
// MAC Address
child->SetExtAddress(extAddr);
@@ -1996,9 +1996,14 @@ void MleRouter::SendParentResponse(Child *aChild, const Challenge &aChallenge, b
exit:
if (error != OT_ERROR_NONE && message != nullptr)
if (error != OT_ERROR_NONE)
{
message->Free();
otLogWarnMle("Failed to send Parent Response: %s", otThreadErrorToString(error));
if (message != nullptr)
{
message->Free();
}
}
}