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

Support for automatic reconnects #106

Merged
merged 4 commits into from
May 26, 2022
Merged

Support for automatic reconnects #106

merged 4 commits into from
May 26, 2022

Conversation

Namoshek
Copy link
Collaborator

@Namoshek Namoshek commented May 7, 2022

As per the discussion in #104, this PR attempts to implement automatic reconnects. The implementation has this feature disabeld by default for backwards compatibility.

To simplify the code and avoid code duplication, writeToSocket() and readFromSocket() have been wrapped with the writeToSocketWithAutoReconnect() and readFromSocketWithAutoReconnect() counterparts. We also do not use auto-reconnect logic during connection handshakes to prevent recursion issues.

As of now, the PR lacks tests because it is quite difficult to have the broker disconnect the client on command. If anyone has an idea what logic could be used to force a disconnect server-side, I'd greatly appreciate it!

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 7, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

35.9% 35.9% Coverage
0.0% 0.0% Duplication

@Namoshek Namoshek merged commit c6046be into master May 26, 2022
@Namoshek Namoshek deleted the feature-auto-reconnect branch May 26, 2022 15:24
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.

1 participant