Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

implement a experimental ssh-keepalive feature #222 #276

Closed
wants to merge 1 commit into from
Closed

implement a experimental ssh-keepalive feature #222 #276

wants to merge 1 commit into from

Conversation

noric
Copy link

@noric noric commented Aug 15, 2013

I wrote a experimental implementation of the ssh keepalive using only the current net-ssh functionalities.

The point is:

  1. Pass an integer value to the ssh.loop method. (It will be used as the IO.select 's fourth argument)
  2. Add a on_process callback to send a SSH_MSG_IGNORE packet.
  3. add '--ssh-keepalive=SECONDS' option to control the ssh keepalive behavior.

So, when the '--ssh-keepalive' option is specified, knife-solo will send a SSH_MSG_IGNORE packet at regular intervals. But when the '--ssh-keepalive' option is not specified, knife-solo's behavior is not changed.

This code would be avoid a knife-solo hang up issue like #222.
But I think that this is not a very good idea...

@@ -274,8 +288,21 @@ def run_command(command, options = {})
result.exit_code = data.read_long
end

if keepalive_interval
jitter_seconds = 3 # TODO: Fix this magic number
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So.... why the magic number? ;)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the '3' is looks like suddenly appeared in the source code. And I think it should be a constant with a comment. But it maybe a matter of preference.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants