Object
# File lib/net/ssh/connection/keepalive.rb, line 18 def enabled? options[:keepalive] end
# File lib/net/ssh/connection/keepalive.rb, line 22 def interval options[:keepalive_interval] || Session::DEFAULT_IO_SELECT_TIMEOUT end
# File lib/net/ssh/connection/keepalive.rb, line 32 def keepalive_maxcount (options[:keepalive_maxcount] || 3).to_i end
# File lib/net/ssh/connection/keepalive.rb, line 14 def options @session.options end
# File lib/net/ssh/connection/keepalive.rb, line 36 def send_as_needed(readers, writers) return unless readers.nil? && writers.nil? return unless should_send? info { "sending keepalive #{@unresponded_keepalive_count}" } @unresponded_keepalive_count += 1 @session.send_global_request("keepalive@openssh.com") { |success, response| debug { "keepalive response successful. Missed #{@unresponded_keepalive_count-1} keepalives" } @unresponded_keepalive_count = 0 } @last_keepalive_sent_at = Time.now if keepalive_maxcount > 0 && @unresponded_keepalive_count > keepalive_maxcount error { "Timeout, server #{@session.host} not responding. Missed #{@unresponded_keepalive_count-1} timeouts." } @unresponded_keepalive_count = 0 raise Net::SSH::Timeout, "Timeout, server #{@session.host} not responding." end end
Generated with the Darkfish Rdoc Generator 2.