zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
9.91k stars 6.1k forks source link

net: lib: coap_client: Improve cancel function #72540

Closed plskeggs closed 3 weeks ago

plskeggs commented 1 month ago

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.

plskeggs commented 1 month ago

@tautologyclub I am unable to add you as a reviewer. I am modifying your cancel function so would like your input.

tautologyclub commented 1 month ago

I def have opinions here, but it'll have to wait until I'm not mega sick anymore, ie a day or two

tautologyclub commented 1 month ago

In general it seems like a strict improvement so LGTM if you've tested it thoroughly

Though I must once again note that my PR should not have been merged. I planned to make a new PR, but I'll hold off until this one is sorted...

glarsennordic commented 3 weeks ago

My comment about the possible bug introduced by https://github.com/zephyrproject-rtos/zephyr/pull/72159 is out of scope for this PR, my bad!

I'll instead copy the comment to that PR and discuss with @tautologyclub about whether it is genuinely a problem, and what to do about it

Edit: New convo is here: https://github.com/zephyrproject-rtos/zephyr/pull/72159#discussion_r1604202521