mirror of
https://github.com/espressif/openthread.git
synced 2026-09-22 08:57:39 +00:00
[coap] ensure InvokeResponseFallback() adheres to style guide (#12223)
This commit moves the implementation of `InvokeResponseFallback()` to the `cpp` file. It also ensures that the implementation follows the style guide requirement of single `return` from any method/function.
This commit is contained in:
+14
-1
@@ -1310,7 +1310,9 @@ exit:
|
||||
|
||||
if (error == kErrorNone && request == nullptr)
|
||||
{
|
||||
if (!InvokeResponseFallback(aMessage, aMessageInfo) && aMessage.RequireResetOnError())
|
||||
bool didHandle = InvokeResponseFallback(aMessage, aMessageInfo);
|
||||
|
||||
if (!didHandle && aMessage.RequireResetOnError())
|
||||
{
|
||||
// Successfully parsed a header but no matching request was
|
||||
// found - reject the message by sending reset.
|
||||
@@ -1319,6 +1321,17 @@ exit:
|
||||
}
|
||||
}
|
||||
|
||||
bool CoapBase::InvokeResponseFallback(Message &aMessage, const Ip6::MessageInfo &aMessageInfo) const
|
||||
{
|
||||
bool didHandle = false;
|
||||
|
||||
VerifyOrExit(mResponseFallback.IsSet());
|
||||
didHandle = mResponseFallback.Invoke(&aMessage, &aMessageInfo);
|
||||
|
||||
exit:
|
||||
return didHandle;
|
||||
}
|
||||
|
||||
void CoapBase::ProcessReceivedRequest(Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
|
||||
{
|
||||
char uriPath[Message::kMaxReceivedUriPath + 1];
|
||||
|
||||
@@ -849,15 +849,7 @@ private:
|
||||
Message *aResponse,
|
||||
const Ip6::MessageInfo *aMessageInfo,
|
||||
Error aResult);
|
||||
|
||||
inline bool InvokeResponseFallback(Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
|
||||
{
|
||||
if (mResponseFallback.IsSet())
|
||||
{
|
||||
return mResponseFallback.Invoke(&aMessage, &aMessageInfo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool InvokeResponseFallback(Message &aMessage, const Ip6::MessageInfo &aMessageInfo) const;
|
||||
|
||||
#if OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE
|
||||
void FreeLastBlockResponse(void);
|
||||
|
||||
Reference in New Issue
Block a user