Class: Knj::SSHRobot::Forward
Instance Attribute Summary collapse
-
#open ⇒ Object
readonly
Returns the value of attribute open.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(args) ⇒ Forward
constructor
A new instance of Forward.
Constructor Details
#initialize(args) ⇒ Forward
Returns a new instance of Forward.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/knj/sshrobot/sshrobot.rb', line 90 def initialize(args) @open = true @args = args @thread = Knj::Thread.new do begin #args[:session].logger.sev_threshold = Logger::Severity::DEBUG if args[:type] == "local" @args[:session].forward.local(@args[:host_local], @args[:port_local].to_i, @args[:host], @args[:port_remote].to_i) elsif args[:type] == "remote" @args[:session].forward.remote_to(@args[:port_local], @args[:host], @args[:port_remote], @args[:host_local]) else raise "No valid type given." end @args[:session].loop do true end rescue => e puts e.inspect puts e.backtrace @open = false end end end |
Instance Attribute Details
#open ⇒ Object (readonly)
Returns the value of attribute open.
88 89 90 |
# File 'lib/knj/sshrobot/sshrobot.rb', line 88 def open @open end |
Instance Method Details
#close ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/knj/sshrobot/sshrobot.rb', line 116 def close if !@args return nil end @args[:session].close @open = false @thread.exit @args = nil @thread = nil end |