Skip to content

fix: ConnectionMonitor is stopped by cancellation token during discon… #251

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

herrmann-m
Copy link

Description

Refactored ConnectionMonitorThread from a Thread to a Task to support proper async execution and cancellation. Updated related logic to use a CancellationToken, and replaced Thread.Sleep with Task.Delay. Updated tests accordingly and added a new test to verify that the connection monitor task stops correctly after disconnect.

This will stop the ConnectionMonitorThread from running forever after a disconnect.

Related Issue

#246

Type of Change

  • 📚 Examples / docs / tutorials / dependencies update
  • 🔧 Bug fix (non-breaking change which fixes an issue)
  • 🥂 Improvement (non-breaking change which improves an existing feature)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🔐 Security fix

Checklist

  • I've written tests (if applicable) for all new methods and classes that I created. (rake test)
  • I've added documentation as necessary so users can easily use and understand this feature/fix.

Copy link

cla-bot bot commented Jul 19, 2025

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @herrmann-m on file. In order for us to review and merge your code, please sign our Contributor License Agreement to get yourself added. You'll find the CLA and more information here: https://github.com/hivemq/hivemq-community/blob/master/CONTRIBUTING.adoc#contributor-license-agreement

@SaschaBa
Copy link
Contributor

Thanks @herrmann-m , this problem annoyed me since some time. Hopefully it comes in fast. ;-) (@pglombardo)

@pglombardo
Copy link
Collaborator

Thanks @herrmann-m & @SaschaBa! @herrmann-m have you signed the CLA yet? cla-bot is getting elderly and sometimes doesn't update. Needs replacement soon.

@herrmann-m
Copy link
Author

Hi @pglombardo, I already singed the CLA after I created the PR

@sauroter
Copy link
Member

Hi @herrmann-m,

could I please ask you to sign the CLA again. We had an IT issue that yours got lost. I am really sorry about this.

All the best
Georg

@herrmann-m
Copy link
Author

Hi @sauroter,

I signed the CLA again, let me know if you need anything else.

Best regards
Michael

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.

4 participants