Class: FFWD::Plugin::Tunnel::BindTCP::Handle

Inherits:
Tunnel::Plugin::Handle
  • Object
show all
Defined in:
lib/ffwd/plugin/tunnel/bind_tcp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bind, addr) ⇒ Handle

Returns a new instance of Handle.



23
24
25
26
27
28
# File 'lib/ffwd/plugin/tunnel/bind_tcp.rb', line 23

def initialize bind, addr
  @bind = bind
  @addr = addr
  @close = nil
  @data = nil
end

Instance Attribute Details

#addrObject (readonly)

Returns the value of attribute addr.



21
22
23
# File 'lib/ffwd/plugin/tunnel/bind_tcp.rb', line 21

def addr
  @addr
end

Instance Method Details

#close(&block) ⇒ Object



34
35
36
# File 'lib/ffwd/plugin/tunnel/bind_tcp.rb', line 34

def close &block
  @close = block
end

#data(&block) ⇒ Object



38
39
40
# File 'lib/ffwd/plugin/tunnel/bind_tcp.rb', line 38

def data &block
  @data = block
end

#recv_closeObject



42
43
44
45
46
47
# File 'lib/ffwd/plugin/tunnel/bind_tcp.rb', line 42

def recv_close
  return if @close.nil?
  @close.call
  @close = nil
  @data = nil
end

#recv_data(data) ⇒ Object



49
50
51
52
# File 'lib/ffwd/plugin/tunnel/bind_tcp.rb', line 49

def recv_data data
  return if @data.nil?
  @data.call data
end

#send_data(data) ⇒ Object



30
31
32
# File 'lib/ffwd/plugin/tunnel/bind_tcp.rb', line 30

def send_data data
  @bind.send_data @addr, data
end