1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

net/gcoap: collection of simple fixes (#7413)

* net/gcoap: fixed request state when getting a resp

The request state should be set to GCOAP_MEMO_RESP before calling
the response handler in case we actually go a response...

* net/gcoap: make test for 0.00 code more efficient

This optimization saves the computation of the code and compares
the raw field to `0`.
This commit is contained in:
Hauke Petersen 2017-07-28 14:15:17 +02:00 committed by Martine Lenders
parent 7b2f503051
commit 36322e95b7

View File

@ -135,7 +135,7 @@ static void _listen(sock_udp_t *sock)
return;
}
if (coap_get_code(&pdu) == COAP_CODE_EMPTY) {
if (pdu.hdr->code == COAP_CODE_EMPTY) {
DEBUG("gcoap: empty messages not handled yet\n");
return;
@ -159,6 +159,7 @@ static void _listen(sock_udp_t *sock)
_find_req_memo(&memo, &pdu, buf, sizeof(buf));
if (memo) {
xtimer_remove(&memo->response_timer);
memo->state = GCOAP_MEMO_RESP;
memo->resp_handler(memo->state, &pdu);
memo->state = GCOAP_MEMO_UNUSED;
}