Method: TCPProxy#close

Defined in:
lib/tcp_proxy.rb

#closeObject

Closes the proxy, disrupting every connection made to it.



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tcp_proxy.rb', line 27

def close
  @shutdown = true
  
  @thread.join
  @thread = nil
  
  # Since the thread is stopped now, we can be sure no new connections are
  # accepted. This is why we access the collection without locking.
  @connections.each do |connection|
    connection.close
  end
  @ins.close if @ins
end