[coap] change SendCopy() to return void (#4941)

This commit is contained in:
Jonathan Hui
2020-05-11 12:44:54 -07:00
parent 5b8b36ab11
commit 5590771eb8
2 changed files with 10 additions and 7 deletions
+9 -6
View File
@@ -375,7 +375,7 @@ void CoapBase::HandleRetransmissionTimer(void)
messageInfo.SetPeerPort(metadata.mDestinationPort);
messageInfo.SetSockAddr(metadata.mSourceAddress);
IgnoreError(SendCopy(*message, messageInfo));
SendCopy(*message, messageInfo);
}
}
@@ -465,7 +465,7 @@ void CoapBase::DequeueMessage(Message &aMessage)
// the timer would just shoot earlier and then it'd be setup again.
}
otError CoapBase::SendCopy(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
void CoapBase::SendCopy(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
{
otError error;
Message *messageCopy = NULL;
@@ -478,12 +478,15 @@ otError CoapBase::SendCopy(const Message &aMessage, const Ip6::MessageInfo &aMes
exit:
if (error != OT_ERROR_NONE && messageCopy != NULL)
if (error != OT_ERROR_NONE)
{
messageCopy->Free();
}
otLogWarnCoap("Failed to send copy: %s", otThreadErrorToString(error));
return error;
if (messageCopy != NULL)
{
messageCopy->Free();
}
}
}
Message *CoapBase::FindRelatedRequest(const Message & aResponse,
+1 -1
View File
@@ -561,7 +561,7 @@ private:
void ProcessReceivedRequest(Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
void ProcessReceivedResponse(Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
otError SendCopy(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
void SendCopy(const Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
otError SendEmptyMessage(Message::Type aType, const Message &aRequest, const Ip6::MessageInfo &aMessageInfo);
otError Send(ot::Message &aMessage, const Ip6::MessageInfo &aMessageInfo);