Method: TCPProxy#accept_connections

Defined in:
lib/tcp_proxy.rb

#accept_connectionsObject



136
137
138
139
140
141
142
143
144
145
146
# File 'lib/tcp_proxy.rb', line 136

def accept_connections
  loop do
    in_sock = @ins.accept_nonblock
    out_sock = TCPSocket.new(@host, @to_port)
    
    @connections_m.synchronize {
      @connections << Connection.new(in_sock, out_sock) }
  end
rescue Errno::EAGAIN
  # No more connections pending, stop accepting new connections
end