RIOT
RIOT copied to clipboard
nanocoap_sock: implement separate response
Contribution description
This adds the capability to nanocoap_server to send separate response, that is a delayed response outside the CoAP handler.
The CoAP handler will first send an empty ACK (if the request was conformable), then some other function can send the actual response at a later time, using nanocoap_sock_send_separate() with the request context information serialized into nanocoap_sock_response_ctx_t.
Testing procedure
A /separate endpoint was added to examples/nanocoap_server:
$ aiocoap-client coap://[fe80::748f:e6ff:fed7:426d%tapbr0]/separate
This is a delayed response.
2024-01-16 19:47:29,617 # main(): This is RIOT! (Version: 2024.01-devel-601-gbd62d-nanocoap_reply_separate)
2024-01-16 19:47:29,618 # RIOT nanocoap example application
2024-01-16 19:47:29,618 # Waiting for address autoconfiguration...
2024-01-16 19:47:31,616 # {"IPv6 addresses": ["fe80::748f:e6ff:fed7:426d"]}
2024-01-16 19:47:33,248 # _separate_handler(): send ACK, schedule response
2024-01-16 19:47:34,248 # _separate_handler(): send delayed response
Issues/PRs references
Murdock results
:heavy_check_mark: PASSED
63d5a5aafa4231e13c57e188eee0218186897fed examples/nanocoap_server: add endpoint with separate response
| Success | Failures | Total | Runtime |
|---|---|---|---|
| 10105 | 0 | 10105 | 13m:03s |