Skip to content

Commit

Permalink
[coap] fix the code to ack the confirmable coap response rather than
Browse files Browse the repository at this point in the history
respond with the payload over the dtls session

based on the CoAP protocol, when a CoAP server receives a confirmable
CoAP response from another device, it should send a CoAP ACK meesage.
  • Loading branch information
ZhangLe2016 committed May 13, 2024
1 parent 0acb262 commit 2fc9a5a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/library/coap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,10 @@ void Coap::HandleRequest(const Request &aRequest)
{
LOG_INFO(LOG_REGION_COAP, "server(={}) found cached CoAP response for resource {}", static_cast<void *>(this),
uriPath);
VerifyOrExit(aRequest.IsConfirmable(), error = SendAck(aRequest));
if (aRequest.IsConfirmable())
{
SuccessOrExit(error = SendAck(aRequest));
}
}

resource = mResources.find(uriPath);
Expand Down

0 comments on commit 2fc9a5a

Please sign in to comment.