708: def disconnect
709: return unless @rye_ssh && !@rye_ssh.closed?
710: begin
711: if @rye_ssh.busy?;
712: info "Is something still running? (ctrl-C to exit)"
713: Timeout::timeout(10) do
714: @rye_ssh.loop(0.3) { @rye_ssh.busy?; }
715: end
716: end
717: debug "Closing connection to #{@rye_ssh.host}"
718: @rye_ssh.close
719: if @rye_via
720: debug "disconnecting Hop #{@rye_via.host}"
721: @rye_via.disconnect
722: end
723: rescue SystemCallError, Timeout::Error => ex
724: error "Rye::Box: Disconnect timeout (#{ex.message})"
725: debug ex.backtrace
726: rescue Interrupt
727: debug "Exiting..."
728: end
729: end