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.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/knj/sshrobot/sshrobot.rb', line 98 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.
96 97 98 |
# File 'lib/knj/sshrobot/sshrobot.rb', line 96 def open @open end |
Instance Method Details
#close ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/knj/sshrobot/sshrobot.rb', line 124 def close if !@args return nil end @args[:session].close @open = false @thread.exit @args = nil @thread = nil end |