coap_net.c: For NON responses, use server generated message id

This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2026-07-25 17:23:48 +01:00
1 parent 0121c25f63
commit f52fadaa9a
1 file changed
+7 -3
+7 -3
View File
@@ -4017,9 +4017,13 @@ handle_request(coap_context_t *context, coap_session_t *session, coap_pdu_t *pdu
goto fail_response;
}
response = coap_pdu_init(pdu->type == COAP_MESSAGE_CON ?
COAP_MESSAGE_ACK : COAP_MESSAGE_NON,
0, pdu->mid, coap_session_max_pdu_size_lkd(session));
if (pdu->type == COAP_MESSAGE_CON) {
response = coap_pdu_init(COAP_MESSAGE_ACK, 0, pdu->mid,
coap_session_max_pdu_size_lkd(session));
} else {
response = coap_pdu_init(COAP_MESSAGE_NON, 0, coap_new_message_id_lkd(session),
coap_session_max_pdu_size_lkd(session));
}
if (!response) {
coap_log_err("could not create response PDU\n");
resp = 500;