Skip to content

Commit

Permalink
fixup! nanocoap/sock: fix context release
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian18 committed Jun 5, 2024
1 parent f3c44f3 commit 710de1c
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions sys/net/application_layer/nanocoap/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ enum {
STATE_REQUEST_SEND, /**< request was just sent or will be sent again */
STATE_STOP_RETRANSMIT, /**< stop retransmissions due to a matching empty ACK */
STATE_WAIT_RESPONSE, /**< waiting for a response */
STATE_RESPONSE_OK, /**< valid response was received */
};

typedef struct {
Expand Down Expand Up @@ -314,26 +313,22 @@ ssize_t nanocoap_sock_request_cb(nanocoap_sock_t *sock, coap_pkt_t *pkt,
case COAP_TYPE_RST:
case COAP_TYPE_CON:
case COAP_TYPE_NON:
state = STATE_RESPONSE_OK;
if (coap_get_type(pkt) == COAP_TYPE_RST) {
/* think about whether cb should be called on RST as well */
res = -EBADMSG;
goto release;
}
if (coap_get_type(pkt) == COAP_TYPE_CON) {
_send_ack(sock, pkt);
}
if (cb) {
res = cb(arg, pkt);
}
else {
if (coap_get_type(pkt) == COAP_TYPE_CON) {
_send_ack(sock, pkt);
}
if (cb) {
res = cb(arg, pkt);
}
else {
res = _get_error(pkt);
}
res = _get_error(pkt);
}
continue;
goto release;
}
case STATE_RESPONSE_OK: /* response received, release ctx */
goto release;
}
}

Expand Down

0 comments on commit 710de1c

Please sign in to comment.