diff --git a/include/zephyr/net/coap.h b/include/zephyr/net/coap.h index d06a7b23dcd..747def6a372 100644 --- a/include/zephyr/net/coap.h +++ b/include/zephyr/net/coap.h @@ -259,6 +259,9 @@ struct coap_option { * @typedef coap_reply_t * @brief Helper function to be called when a response matches the * a pending request. + * When sending blocks, the callback is only executed when the + * reply of the last block is received. + * i.e. it is not called when the code of the reply is 'continue' (2.31). */ typedef int (*coap_reply_t)(const struct coap_packet *response, struct coap_reply *reply, diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index a4dab38eee8..5b0da6d9bc5 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -1499,7 +1499,9 @@ struct coap_reply *coap_response_received( /* handle observed requests only if received in order */ if (age == -ENOENT || is_newer(r->age, age)) { r->age = age; - r->reply(response, r, from); + if (coap_header_get_code(response) != COAP_RESPONSE_CODE_CONTINUE) { + r->reply(response, r, from); + } } return r;