Skip to content

Commit d3ba674

Browse files
rluboscfriedt
authored andcommitted
net: lwm2m: Handle RESET replies for separate response
Separate CON responses do no have a reply callback registered (as no response is expected), however are still registered for retransmission on the pending list. Therefore, we not only need to check for empty ACKs for such case but for RESET packets as well. However, this cannot be done before "reply" processing, as some of the reply handlers (notifications namely) check for RESET replies. Therefore, add a final check for the RESET response after the existing "reply" logic. In such case, just remove the pending response packet from the retransmission queue, and release resources. Signed-off-by: Robert Lubos <[email protected]>
1 parent cf28b5a commit d3ba674

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

subsys/net/lib/lwm2m/lwm2m_message_handling.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2881,6 +2881,16 @@ void lwm2m_udp_receive(struct lwm2m_ctx *client_ctx, uint8_t *buf, uint16_t buf_
28812881

28822882
LOG_DBG("reply %p handled and removed", reply);
28832883
goto client_unlock;
2884+
} else if (pending && coap_header_get_type(&response) == COAP_TYPE_RESET) {
2885+
msg = find_msg(pending, NULL);
2886+
if (msg == NULL) {
2887+
LOG_ERR("Orphaned pending %p.", pending);
2888+
coap_pending_clear(pending);
2889+
goto client_unlock;
2890+
}
2891+
2892+
lwm2m_reset_message(msg, true);
2893+
goto client_unlock;
28842894
}
28852895

28862896
lwm2m_client_unlock(client_ctx);

0 commit comments

Comments
 (0)