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

net: lib: coap_client: Improve cancel function #1667

Closed
wants to merge 2 commits into from

Conversation

plskeggs
Copy link
Contributor

@plskeggs plskeggs commented Apr 24, 2024

Improve coap_client_cancel_requests(). Ensure it can be called from a callback. Clear pending reqs. Report error to waiting callbacks. Clear active flag.

This is useful when the network becomes unavailable or prior to disconnecting in order to save power.

(cherry picked from commit f04f8b2)

@plskeggs plskeggs force-pushed the feature-coap-client-cancel branch 2 times, most recently from 5f32af8 to 360b989 Compare April 24, 2024 23:38
@plskeggs
Copy link
Contributor Author

@juhaylinen @SeppoTakalo -- I would like your early review of this. If you agree with the approach then I will create an upstream PR and add the appropriate sauce tag here.

Copy link
Contributor

@SeppoTakalo SeppoTakalo left a comment

Choose a reason for hiding this comment

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

I think the API is OK.

Clarify:

  • Can the cancellation be called within the callback (like when we receive blockwise Block N=0).
  • Does the cancellation work for blockwise?

include/zephyr/net/coap_client.h Outdated Show resolved Hide resolved
subsys/net/lib/coap/coap_client.c Outdated Show resolved Hide resolved
include/zephyr/net/coap_client.h Outdated Show resolved Hide resolved
@plskeggs plskeggs force-pushed the feature-coap-client-cancel branch 2 times, most recently from 55162d0 to 544ff88 Compare May 3, 2024 19:53
@plskeggs plskeggs force-pushed the feature-coap-client-cancel branch from 303d143 to ae91c6d Compare May 8, 2024 20:31
@plskeggs plskeggs force-pushed the feature-coap-client-cancel branch 2 times, most recently from 93a5804 to 6f429b1 Compare May 8, 2024 21:24
@plskeggs plskeggs marked this pull request as ready for review May 8, 2024 23:47
@NordicBuilder NordicBuilder requested review from jukkar and rlubos May 8, 2024 23:47
@plskeggs plskeggs added this to the ncs-2.7.0 milestone May 9, 2024
@plskeggs plskeggs force-pushed the feature-coap-client-cancel branch from 6f429b1 to b9f5451 Compare May 10, 2024 00:22
@plskeggs plskeggs changed the title net: lib: coap_client: Add coap_client_cancel_req net: lib: coap_client: Improve cancel function May 10, 2024
@plskeggs plskeggs force-pushed the feature-coap-client-cancel branch 2 times, most recently from a52c071 to b8ee665 Compare May 10, 2024 21:05
@plskeggs plskeggs requested a review from glarsennordic May 10, 2024 23:27
@plskeggs plskeggs force-pushed the feature-coap-client-cancel branch 2 times, most recently from d948199 to 8897b2a Compare May 15, 2024 23:41
Copy link
Contributor

@glarsennordic glarsennordic left a comment

Choose a reason for hiding this comment

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

I have some comments, but I left them on the upstream zephyr PR

@plskeggs plskeggs force-pushed the feature-coap-client-cancel branch from 8897b2a to 8449afd Compare May 17, 2024 00:50
@glarsennordic glarsennordic self-requested a review May 17, 2024 01:03
@plskeggs plskeggs force-pushed the feature-coap-client-cancel branch from 8449afd to 9266e96 Compare May 17, 2024 01:05
@plskeggs plskeggs force-pushed the feature-coap-client-cancel branch from 9266e96 to b53dfab Compare May 17, 2024 17:57
@plskeggs plskeggs requested review from carlescufi and nordicjm May 17, 2024 18:00
@plskeggs
Copy link
Contributor Author

plskeggs commented May 17, 2024

@carlescufi I updated my commit in this PR to be fromtree instead of fromlist now that the upstream PR has merged.

@plskeggs plskeggs force-pushed the feature-coap-client-cancel branch 2 times, most recently from 535db7f to 788b038 Compare May 22, 2024 18:34
tautologyclub and others added 2 commits May 24, 2024 15:22
The coap_client lib only handled "one-shot" requests properly. This
patch allows it to keep listening for additional responses to a request,
if the request was made with the CoAP OBSERVE option appended.

An API for canceling such requests is also added.

Signed-off-by: Benjamin Lindqvist <[email protected]>
(cherry picked from commit 0d14143)
Improve coap_client_cancel_requests(). Ensure it can be
called from a callback. Report error to waiting callbacks.
Clear active flag.

This is useful when the network becomes unavailable
or prior to disconnecting in order to save power.

Signed-off-by: Pete Skeggs <[email protected]>
(cherry picked from commit f04f8b2)
@plskeggs plskeggs force-pushed the feature-coap-client-cancel branch from 788b038 to 43dc8c6 Compare May 24, 2024 22:24
@plskeggs plskeggs closed this May 31, 2024
@plskeggs
Copy link
Contributor Author

No longer necessary; the upstream PR merged and was included in the recent upmerge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants