-
Notifications
You must be signed in to change notification settings - Fork 15
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
Stop client before destroying #547
Conversation
When purge_request_mbox() it was conditionally freeing POST quests but should also check for POST_BLOCK requests which have a dynamically allocated payload. Signed-off-by: Mike Szczys <[email protected]>
If the client is running when golioth_client_destroy() is called it needs to be stopped before freeing the client. When the client is stopped, the logging backend will be disabled, preventing log messages from trying to access the client after it is freed. The linked list of requests (client->coap_reqs) will then also be freed as part of the stop process, ensuring there isn't any allocated OBSERVE or POST/POST_BLOCK memory leaked. Signed-off-by: Mike Szczys <[email protected]>
Visit the preview URL for this PR (updated for commit 94fc673): https://golioth-firmware-sdk-doxygen-dev--pr547-szczys-fix-cli-fte3fpvq.web.app (expires Wed, 07 Aug 2024 14:56:17 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: a9993e61697a3983f3479e468bcb0b616f9a0578 |
Code Coverage
|
When purge_request_mbox() it was conditionally freeing POST quests but should also check for POST_BLOCK requests which have a dynamically allocated payload. Signed-off-by: Mike Szczys <[email protected]>
Automatic formatting was applied to this file, no substantive changes were made to the code. Signed-off-by: Mike Szczys <[email protected]>
63669b9
to
a0a7bf5
Compare
This prevents attempts to send logs messages to the cloud when the client is disconnected. Upon reconnect, backend logging will be enabled based on CONFIG_GOLIOTH_AUTO_LOG_TO_CLOUD. Signed-off-by: Mike Szczys <[email protected]>
If the client is running when golioth_client_destroy() is called it needs to be stopped before freeing the client. When the client is stopped, golioth_sys_client_disconnected() is now called which in turn sets golioth_debug_set_cloud_log_enabled() to false. This prevents attempts to send log messages to Golioth when the client is not connected. Signed-off-by: Mike Szczys <[email protected]>
e7e2dcc
to
63d2136
Compare
63d2136
to
845f68e
Compare
- Add golioth_client_destroy() and subsequent reconnect to test ability to destroy and restart the client - Add a semaphore to block until each new connection is established. Signed-off-by: Mike Szczys <[email protected]>
845f68e
to
94fc673
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @szczys!
@@ -14,38 +14,45 @@ | |||
* Time | |||
*------------------------------------------------*/ | |||
|
|||
uint64_t golioth_sys_now_ms() { | |||
uint64_t golioth_sys_now_ms() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are moving from the FreeRTOS port to the system ports (ESP-IDF, ModusToolBox, etc.) in #486, but I think it's fine to keep it here for now.
resolves https://github.com/golioth/firmware-issue-tracker/issues/584