RIOT icon indicating copy to clipboard operation
RIOT copied to clipboard

nanocoap_sock: implement separate response

Open benpicco opened this issue 2 years ago • 1 comments

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

benpicco avatar Jan 16 '24 18:01 benpicco

Murdock results

:heavy_check_mark: PASSED

63d5a5aafa4231e13c57e188eee0218186897fed examples/nanocoap_server: add endpoint with separate response

Success Failures Total Runtime
10105 0 10105 13m:03s

Artifacts

riot-ci avatar Jan 16 '24 22:01 riot-ci