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

GH-268: Fix ClientConnectionService.sendHeartBeat() #274

Merged
merged 1 commit into from
Nov 23, 2022

Conversation

tomaswolf
Copy link
Member

@tomaswolf tomaswolf commented Nov 22, 2022

If a reply is requested, but none arrives within the timeout, throw an
exception and terminate the connection.

This rolls back the changes made in ClientConnectionService in commit
de2f8fe. It's quite all right to use the synchronous implementation of
Session.request() because heartbeats are not sent from I/O threads.

However, commit de2f8fe broke the contract specified in interface
Session, which says Session.request() must return "the buffer if the
request was successful, null otherwise." The implementation from
commit de2f8fe threw an exception instead.

This was wrong, and is corrected now in this commit. Note that this
means that a caller cannot distinguish between the server replying
SSH_MSG_UNIMPLEMENTED or SSH_MSG_REQUEST_FAILURE.

Where such distinction is needed, use an asynchronous global request
instead.

Fixes #268.

@tomaswolf tomaswolf marked this pull request as draft November 23, 2022 06:55
If a reply is requested, but none arrives within the timeout, throw an
exception and terminate the connection.

This rolls back the changes made in ClientConnectionService in commit
de2f8fe. It's quite all right to use the synchronous implementation of
Session.request() because heartbeats are not sent from I/O threads.

However, commit de2f8fe broke the contract specified in interface
Session, which says Session.request() must return "the buffer if the
request was successful, {@code null} otherwise." The implementation
from commit de2f8fe threw an exception instead.

This was wrong, and is corrected now in this commit. Note that this
means that a caller cannot distinguish between the server replying
SSH_MSG_UNIMPLEMENTED or SSH_MSG_REQUEST_FAILURE.

Where such distinction is needed, use an asynchronous global request
instead.

Bug: apache#268
@tomaswolf tomaswolf marked this pull request as ready for review November 23, 2022 21:42
@tomaswolf tomaswolf merged commit 29ed50c into apache:master Nov 23, 2022
@tomaswolf tomaswolf deleted the gh-268 branch November 29, 2022 19:04
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.

Heartbeat does not respond to timeout while waiting for a response from the server
1 participant