Class: ReverseTunnel::Server::LocalConnection
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- ReverseTunnel::Server::LocalConnection
- Defined in:
- lib/reverse-tunnel/server.rb
Instance Attribute Summary collapse
-
#tunnel ⇒ Object
Returns the value of attribute tunnel.
Instance Method Summary collapse
-
#initialize(tunnel) ⇒ LocalConnection
constructor
A new instance of LocalConnection.
- #post_init ⇒ Object
- #receive_data(data) ⇒ Object
- #session_id ⇒ Object
- #unbind ⇒ Object
Constructor Details
#initialize(tunnel) ⇒ LocalConnection
Returns a new instance of LocalConnection.
267 268 269 |
# File 'lib/reverse-tunnel/server.rb', line 267 def initialize(tunnel) @tunnel = tunnel end |
Instance Attribute Details
#tunnel ⇒ Object
Returns the value of attribute tunnel.
265 266 267 |
# File 'lib/reverse-tunnel/server.rb', line 265 def tunnel @tunnel end |
Instance Method Details
#post_init ⇒ Object
271 272 273 274 275 |
# File 'lib/reverse-tunnel/server.rb', line 271 def post_init ReverseTunnel.logger.debug { "New local connection" } tunnel.local_connections << self tunnel.open_session(session_id) end |
#receive_data(data) ⇒ Object
277 278 279 280 |
# File 'lib/reverse-tunnel/server.rb', line 277 def receive_data(data) ReverseTunnel.logger.debug { "Received data in local #{session_id}" } tunnel.send_data session_id, data end |
#session_id ⇒ Object
282 283 284 |
# File 'lib/reverse-tunnel/server.rb', line 282 def session_id @session_id ||= tunnel.next_session_id end |
#unbind ⇒ Object
286 287 288 289 |
# File 'lib/reverse-tunnel/server.rb', line 286 def unbind ReverseTunnel.logger.debug { "Close local connection" } tunnel.local_connections.delete self end |