thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
210 stars 54 forks source link

fix: tedge mqtt ignoring ctrl-c when connection fails #2950

Closed didier-wenzek closed 1 week ago

didier-wenzek commented 1 week ago

Proposed changes

As rumqttc doesn't trigger a client disconnect when the connection is not established, one has to combine a client disconnect with the use of an AtomicBool to break the event loop if for some reason the connection is not established when the user hits ctrl-c.

Types of changes

Paste Link to the issue

https://github.com/thin-edge/thin-edge.io/issues/2949

Checklist

Further comments

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 44.44444% with 5 lines in your changes missing coverage. Please review.

Project coverage is 78.2%. Comparing base (5826ae2) to head (ed0b7fd). Report is 10 commits behind head on main.

Additional details and impacted files | [Files](https://app.codecov.io/gh/thin-edge/thin-edge.io/pull/2950?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thin-edge) | Coverage Δ | | |---|---|---| | [crates/core/tedge/src/cli/mqtt/mod.rs](https://app.codecov.io/gh/thin-edge/thin-edge.io/pull/2950?src=pr&el=tree&filepath=crates%2Fcore%2Ftedge%2Fsrc%2Fcli%2Fmqtt%2Fmod.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thin-edge#diff-Y3JhdGVzL2NvcmUvdGVkZ2Uvc3JjL2NsaS9tcXR0L21vZC5ycw==) | `66.6% <80.0%> (-2.6%)` | :arrow_down: | | [crates/core/tedge/src/cli/mqtt/subscribe.rs](https://app.codecov.io/gh/thin-edge/thin-edge.io/pull/2950?src=pr&el=tree&filepath=crates%2Fcore%2Ftedge%2Fsrc%2Fcli%2Fmqtt%2Fsubscribe.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thin-edge#diff-Y3JhdGVzL2NvcmUvdGVkZ2Uvc3JjL2NsaS9tcXR0L3N1YnNjcmliZS5ycw==) | `0.0% <0.0%> (ø)` | | ... and [11 files with indirect coverage changes](https://app.codecov.io/gh/thin-edge/thin-edge.io/pull/2950/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thin-edge)
github-actions[bot] commented 1 week ago

Robot Results

:white_check_mark: Passed :x: Failed :next_track_button: Skipped Total Pass % :stopwatch: Duration
453 0 3 453 100 1h1m13.030747999s