1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-29 00:11:16 +01:00

Merge pull request #18221 from benpicco/nanocoap_sock_request_cb-assert

nanocoap_sock: fix wrong assertion
This commit is contained in:
benpicco 2022-06-17 10:14:11 +02:00 committed by GitHub
commit b2ed5af665
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,6 +175,7 @@ ssize_t nanocoap_sock_request_cb(nanocoap_sock_t *sock, coap_pkt_t *pkt,
case STATE_RESPONSE_OK:
DEBUG("nanocoap: waiting for response (timeout: %"PRIu32" µs)\n",
_deadline_left_us(deadline));
const void *old_ctx = ctx;
tmp = sock_udp_recv_buf(sock, &payload, &ctx, _deadline_left_us(deadline), NULL);
/* sock_udp_recv_buf() is supposed to return multiple packet fragments
* when called multiple times with the same context.
@ -183,7 +184,7 @@ ssize_t nanocoap_sock_request_cb(nanocoap_sock_t *sock, coap_pkt_t *pkt,
* releases the packet.
* This assertion will trigger should the behavior change in the future.
*/
if (state != STATE_REQUEST_SEND) {
if (old_ctx) {
assert(tmp == 0 && ctx == NULL);
}
if (tmp == 0) {