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
10.14k stars 6.23k forks source link

Handle LwM2M requests asynchronously #73224

Open koalatux opened 1 month ago

koalatux commented 1 month ago

Is your enhancement proposal related to a problem? Please describe. Handling of LwM2M requests is done in a blocking way. While handling a request no other requests can be handled at that time. To build a response we would like to query information from an external component, which can take some seconds. We would like to handle other LwM2M requests during that time.

Describe the solution you'd like In a request callback we would like to store the LwM2M request context away, send an empty CoAP ACK and tell the LwM2M engine it should not send a response upon returning of the callback. Later we want to send the response separately from a different thread using the previously stored request context.

Describe alternatives you've considered We considered calling lwm2m_acknowledge() to send an empty CoAP ACK and then block the LwM2M thread until we have the final response. While this somewhat lowers the pain it still does not allow handling of other LwM2M messages nor does it send repeated acknowledge messages for receiving duplicate requests in case the first acknowledge got lost.

Additional context None

github-actions[bot] commented 1 month ago

Hi @koalatux! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙