Class: TCPStackHelper

Inherits:
StackHelper show all
Defined in:
lib/diameter/stack_transport_helpers.rb

Instance Method Summary (collapse)

Methods inherited from StackHelper

#initialize, #main_loop, #send, #start_main_loop, #wakeup

Constructor Details

This class inherits a constructor from StackHelper

Instance Method Details

- (Object) accept_loop



97
98
99
100
101
102
103
104
105
106
# File 'lib/diameter/stack_transport_helpers.rb', line 97

def accept_loop
  rs, _ws, es = IO.select(@listen_connections, [], @listen_connections)
  es.each do |e|
    Diameter.logger.log(Logger::WARN, "Exception on connection #{e}")
  end

  rs.each do |r|
    @all_connections.push r.accept_nonblock
  end
end

- (Object) setup_new_connection(host, port)



85
86
87
88
89
90
91
92
# File 'lib/diameter/stack_transport_helpers.rb', line 85

def setup_new_connection(host, port)
  sd = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
  sd.connect(Socket.pack_sockaddr_in(port, host))
  @all_connections.push sd
  @data[sd] = ''
  wakeup
  sd
end

- (Object) setup_new_listen_connection(_host, _port)



94
95
# File 'lib/diameter/stack_transport_helpers.rb', line 94

def setup_new_listen_connection(_host, _port)
end