net: coap: Improve the handling of CoAP response code 'continue'
When using block-wise transfer, call the reply callback only when the last block arrived. Signed-off-by: Lukas Woodtli <lukas.woodtli@husqvarnagroup.com>
This commit is contained in:
parent
96aefc09da
commit
2f6c0d7ca3
@ -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,
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user