Class: Tortard::Bridge::Connection
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- Tortard::Bridge::Connection
- Includes:
- EM::Socksify
- Defined in:
- lib/tortard/bridge/connection.rb
Instance Attribute Summary collapse
-
#bridge ⇒ Object
Returns the value of attribute bridge.
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #connection_completed ⇒ Object
- #receive_data(data) ⇒ Object
- #send_data(data) ⇒ Object
- #unbind ⇒ Object
Instance Attribute Details
#bridge ⇒ Object
Returns the value of attribute bridge.
18 19 20 |
# File 'lib/tortard/bridge/connection.rb', line 18 def bridge @bridge end |
#client ⇒ Object
Returns the value of attribute client.
18 19 20 |
# File 'lib/tortard/bridge/connection.rb', line 18 def client @client end |
Instance Method Details
#connection_completed ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/tortard/bridge/connection.rb', line 20 def connection_completed socksify(bridge.from.host, bridge.from.port).callback { if bridge.ssl == :both || bridge.ssl == :internal start_tls end @client.connected }.errback {|e| Tortard.log "failed to connect to #{bridge.from}" } end |
#receive_data(data) ⇒ Object
32 33 34 |
# File 'lib/tortard/bridge/connection.rb', line 32 def receive_data (data) @client.received data end |
#send_data(data) ⇒ Object
36 37 38 |
# File 'lib/tortard/bridge/connection.rb', line 36 def send_data (data) super end |
#unbind ⇒ Object
40 41 42 |
# File 'lib/tortard/bridge/connection.rb', line 40 def unbind @client.close_connection_after_writing if @client end |