Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nanocoap_sock: implement separate response #20266

Merged
merged 9 commits into from
May 21, 2024

Conversation

benpicco
Copy link
Contributor

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

@github-actions github-actions bot added Area: network Area: Networking Area: CoAP Area: Constrained Application Protocol implementations Area: sys Area: System Area: examples Area: Example Applications labels Jan 16, 2024
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 16, 2024
@riot-ci
Copy link

riot-ci commented Jan 16, 2024

Murdock results

✔️ PASSED

63d5a5a examples/nanocoap_server: add endpoint with separate response

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

Artifacts

@benpicco benpicco added the Type: new feature The issue requests / The PR implemements a new feature for RIOT label Jan 18, 2024
@benpicco benpicco requested a review from fabian18 March 7, 2024 13:09
sys/net/application_layer/nanocoap/nanocoap.c Outdated Show resolved Hide resolved
sys/include/net/nanocoap_sock.h Outdated Show resolved Hide resolved
sys/include/net/nanocoap.h Show resolved Hide resolved
sys/include/net/nanocoap_sock.h Outdated Show resolved Hide resolved
examples/nanocoap_server/coap_handler.c Show resolved Hide resolved
examples/nanocoap_server/coap_handler.c Outdated Show resolved Hide resolved
sys/net/application_layer/nanocoap/sock.c Show resolved Hide resolved
sys/include/net/nanocoap.h Show resolved Hide resolved
sys/net/application_layer/nanocoap/sock.c Outdated Show resolved Hide resolved
sys/net/application_layer/nanocoap/nanocoap.c Show resolved Hide resolved
examples/nanocoap_server/Makefile Outdated Show resolved Hide resolved
sys/include/net/nanocoap_sock.h Outdated Show resolved Hide resolved
sys/include/net/nanocoap_sock.h Outdated Show resolved Hide resolved
sys/net/application_layer/nanocoap/sock.c Outdated Show resolved Hide resolved
sys/net/application_layer/nanocoap/nanocoap.c Outdated Show resolved Hide resolved
Copy link
Contributor

@fabian18 fabian18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may squash. ACK

@benpicco benpicco added this pull request to the merge queue May 21, 2024
Merged via the queue into RIOT-OS:master with commit 3f41494 May 21, 2024
25 checks passed
@benpicco benpicco deleted the nanocoap_reply_separate branch May 21, 2024 21:37
@mguetschow mguetschow added this to the Release 2024.07 milestone Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: CoAP Area: Constrained Application Protocol implementations Area: examples Area: Example Applications Area: network Area: Networking Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants