diff --git a/sys/net/application_layer/nanocoap/sock.c b/sys/net/application_layer/nanocoap/sock.c index ae8d0f40b5..6e3a7344b7 100644 --- a/sys/net/application_layer/nanocoap/sock.c +++ b/sys/net/application_layer/nanocoap/sock.c @@ -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) {