Skip to content
Snippets Groups Projects
Commit ad38dd9a authored by Ken Bannister's avatar Ken Bannister
Browse files

net/nanocoap: fix non-confirmable response type

parent 6c847b82
No related branches found
No related tags found
No related merge requests found
...@@ -370,8 +370,16 @@ ssize_t coap_build_reply(coap_pkt_t *pkt, unsigned code, ...@@ -370,8 +370,16 @@ ssize_t coap_build_reply(coap_pkt_t *pkt, unsigned code,
return -ENOSPC; return -ENOSPC;
} }
/* if code is COAP_CODE_EMPTY (zero), use RST as type, else RESP */ /* if code is COAP_CODE_EMPTY (zero), assume Reset (RST) type */
unsigned type = code ? COAP_RESP : COAP_RST; unsigned type = COAP_TYPE_RST;
if (code) {
if (coap_get_type(pkt) == COAP_TYPE_CON) {
type = COAP_TYPE_ACK;
}
else {
type = COAP_TYPE_NON;
}
}
coap_build_hdr((coap_hdr_t *)rbuf, type, pkt->token, tkl, code, coap_build_hdr((coap_hdr_t *)rbuf, type, pkt->token, tkl, code,
ntohs(pkt->hdr->id)); ntohs(pkt->hdr->id));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment