Skip to content

Conversation

eugeneius
Copy link

Net::SSH supports sending keepalive packets to the server to check whether the connection is still alive. For this to work, IO#select needs to be given a timeout so that the event loop can run periodically and send the packets.

@eugeneius
Copy link
Author

@delano any chance you could take a look at this?

@@ -441,6 +441,17 @@ def process(wait=nil, &block)
end
end

def io_select_wait(wait)
return wait if wait
Copy link
Collaborator

Choose a reason for hiding this comment

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

could write as wait || keepalive_intreval actually we should wait for the smaller of two, shouldn't we?

Copy link
Author

Choose a reason for hiding this comment

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

I based this on the implementation in net-ssh, where the wait argument takes precedence over the keepalive interval: https://github.com/net-ssh/net-ssh/blob/v3.0.2/lib/net/ssh/connection/session.rb#L611-L615

I agree though, using the smaller of the two values seems more correct to me. I'll fix it here, and submit a pull request to net-ssh to change the behaviour there too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

good catch needs to be fixed in net-ssh as well

Net::SSH supports sending keepalive packets to the server to check
whether the connection is still alive. For this to work, IO#select needs
to be given a timeout so that the event loop can run periodically and
send the packets.
mfazekas added a commit that referenced this pull request Mar 12, 2016
Use keepalive_interval option as IO select timeout
@mfazekas mfazekas merged commit 3852c73 into net-ssh:master Mar 12, 2016
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.

2 participants