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

Guard against sending heartbeats if the underlying socket is closed #95

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

achilleasa
Copy link
Owner

If the connection to the server is lost before the library gets a chance to detect this and cancel the heartbeat timer, there is a small window where the client will attempt to send a heartbeat and an exception will be thrown.

This commit attempts to guard against this by checking the channel and socket status before attempting to transmit the heartbeat message as well as by wrapping the send request in a try/catch block and suppressing any thrown exceptions.

Fixes #94

If the connection to the server is lost before the library gets a chance
to detect this and cancel the heartbeat timer, there is a small window
where the client will attempt to send a heartbeat and an exception will
be thrown.

This commit attempts to guard against this by checking the channel and
socket status before attempting to transmit the heartbeat message as
well as by wrapping the send request in a try/catch block and
suppressing any thrown exceptions.
@achilleasa achilleasa merged commit 1f339fb into master Mar 9, 2023
@achilleasa achilleasa deleted the skip-hearbeats-for-closed-channels branch March 9, 2023 20:01
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.

Client dispose after connection lost error
1 participant