diff options
Diffstat (limited to 'lib/oxidized/input')
-rw-r--r-- | lib/oxidized/input/ssh.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb index ef15292..a858213 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -50,12 +50,12 @@ module Oxidized private def disconnect - begin - disconnect_cli - @ssh.loop - @ssh.close if not @ssh.closed? - rescue Errno::ECONNRESET, Net::SSH::Disconnect, IOError - end + disconnect_cli + # if disconnect does not disconnect us, give up after timeout + Timeout::timeout(CFG.timeout) { @ssh.loop } + rescue Errno::ECONNRESET, Net::SSH::Disconnect, IOError + ensure + @ssh.close if not @ssh.closed? end def shell_open ssh |