Method: TCPProxy#forward_data

Defined in:
lib/tcp_proxy.rb

#forward_dataObject



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/tcp_proxy.rb', line 149

def forward_data
  connections = @connections_m.synchronize { @connections.dup }
  remove_list = []
  connections.each do |conn|
    begin
      conn.pump_synchronized
    rescue EOFError
      # Socket was closed, remove from the collection.
      remove_list << conn
    end
  end

  @connections_m.synchronize {
    @connections -= remove_list
  }
end