Skip to content

Commit

Permalink
Suppress RST when the processing of a non-empty ACK fails
Browse files Browse the repository at this point in the history
  • Loading branch information
kkrentz authored and mrdeep1 committed Oct 19, 2023
1 parent bb1a635 commit 6addbef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/coap3/coap_net.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ typedef enum coap_response_t {
* @param mid CoAP transaction ID.
* @return @c COAP_RESPONSE_OK if successful, else @c COAP_RESPONSE_FAIL which
* triggers sending a RST packet.
* triggers sending a RST packet if the received PDU is a CON or NON.
*/
typedef coap_response_t (*coap_response_handler_t)(coap_session_t *session,
const coap_pdu_t *sent,
Expand Down
5 changes: 3 additions & 2 deletions src/coap_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -3406,8 +3406,9 @@ handle_response(coap_context_t *context, coap_session_t *session,

/* Call application-specific response handler when available. */
if (context->response_handler) {
if (context->response_handler(session, sent, rcvd,
rcvd->mid) == COAP_RESPONSE_FAIL)
if ((context->response_handler(session, sent, rcvd,
rcvd->mid) == COAP_RESPONSE_FAIL) &&
(rcvd->type != COAP_MESSAGE_ACK))
coap_send_rst(session, rcvd);
else
coap_send_ack(session, rcvd);
Expand Down

0 comments on commit 6addbef

Please sign in to comment.