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

311 adapter lifecycle foundations #293

Merged
merged 11 commits into from
Jun 5, 2023
Merged

311 adapter lifecycle foundations #293

merged 11 commits into from
Jun 5, 2023

Conversation

bretambrose
Copy link
Contributor

@bretambrose bretambrose commented May 24, 2023

Misc. functionality needed to support connect/disconnect and lifecycle events in the 311_to_5 adapter

  • Adds support for internal observers to reset the mqtt5 client's connection when it is established or being established.
  • Reworks how ref-counting and state changes are protected and adds a simple helper function to safely make callbacks based on synchronized state
  • Splits ref-counting into external and internal. Internal is all ref-counts made inside the implementation in order to extend the lifetime of the adapter long enough to safely handle asynchronous operations. External is ref counts made by users. The adapter now follows a contract where as soon as the last external ref count is released, no more callbacks to user code will be made under any circumstances. This greatly simplifies shutdown from a user perspective (it definitely complicates things internally).
  • Move the adapter's locking approach to a read-write lock rather than a mutex.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

codecov-commenter commented May 26, 2023

Codecov Report

Patch coverage: 53.78% and project coverage change: -0.18 ⚠️

Comparison is base (d3377e4) 80.34% compared to head (96d45cb) 80.17%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #293      +/-   ##
==========================================
- Coverage   80.34%   80.17%   -0.18%     
==========================================
  Files          18       18              
  Lines        7571     7625      +54     
==========================================
+ Hits         6083     6113      +30     
- Misses       1488     1512      +24     
Impacted Files Coverage Δ
source/mqtt.c 94.59% <ø> (ø)
source/v5/mqtt5_client.c 87.63% <8.33%> (-0.72%) ⬇️
source/mqtt3_to_mqtt5_adapter.c 45.27% <58.87%> (+2.77%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@bretambrose bretambrose changed the title mqtt5 connection reset support 311 adapter lifecycle foundations May 30, 2023
@bretambrose bretambrose merged commit 8e40355 into main Jun 5, 2023
31 checks passed
@bretambrose bretambrose deleted the AdapterLifecycle1 branch June 5, 2023 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants