Class: SocksTunnel::Local::Connection
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- SocksTunnel::Local::Connection
- Defined in:
- lib/socks_tunnel/local.rb
Instance Attribute Summary collapse
-
#server ⇒ Object
Returns the value of attribute server.
Instance Method Summary collapse
Instance Attribute Details
#server ⇒ Object
Returns the value of attribute server.
14 15 16 |
# File 'lib/socks_tunnel/local.rb', line 14 def server @server end |
Instance Method Details
#post_init ⇒ Object
16 17 18 19 |
# File 'lib/socks_tunnel/local.rb', line 16 def post_init @coder = Coder.new @buffer = Buffer.new end |
#receive_data(data) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/socks_tunnel/local.rb', line 27 def receive_data(data) return if data.nil? || data.empty? @buffer << data @buffer.each do |segment| server.send_data(@coder.decode(segment)) end end |
#send_encoded_data(data) ⇒ Object
21 22 23 24 25 |
# File 'lib/socks_tunnel/local.rb', line 21 def send_encoded_data(data) return if data.nil? || data.empty? send_data(@coder.encode(data)) send_data(Config.delimiter) end |
#unbind ⇒ Object
35 36 37 |
# File 'lib/socks_tunnel/local.rb', line 35 def unbind server.close_connection_after_writing end |