pdu: Make sure type is set to CON if Reliable

This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2023-10-19 11:02:13 +01:00
1 parent cd1a7de0f2
commit 95faeac5bb
2 files changed
+6 -1

No files matched your search

+1 -1
View File
@@ -1096,7 +1096,7 @@ coap_send(coap_session_t *session, coap_pdu_t *pdu) {
}
/* A lot of the reliable code assumes type is CON */
if (COAP_PROTO_RELIABLE(session->proto) && pdu->type == COAP_MESSAGE_NON)
if (COAP_PROTO_RELIABLE(session->proto) && pdu->type != COAP_MESSAGE_CON)
pdu->type = COAP_MESSAGE_CON;
#if COAP_OSCORE_SUPPORT
+5
View File
@@ -1435,6 +1435,11 @@ coap_pdu_encode_header(coap_pdu_t *pdu, coap_proto_t proto) {
coap_log_warn("coap_pdu_encode_header: corrupted PDU\n");
return 0;
}
/* A lot of the reliable code assumes type is CON */
if (pdu->type != COAP_MESSAGE_CON)
pdu->type = COAP_MESSAGE_CON;
if (proto == COAP_PROTO_WS || proto == COAP_PROTO_WSS)
len = 0;
else