Method: Networking::TCPClient#open_socket

Defined in:
lib/networking/tcp.rb

#open_socketObject

This function may be executed only from one thread!!! or in synchronized manner. private



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/networking/tcp.rb', line 165

def open_socket
  Log.debug1("Connecting to content server %s:%s", @host, @port)
  begin
    @tcp_socket = TCPSocket.new(@host, @port)
  rescue Errno::ECONNREFUSED
    Log.warning('Connection refused')
  end
  Log.debug3("Reconnect clb: %s", @reconnected_clb)
  if socket_good?
    @remote_server_available_mutex.synchronize {
      @remote_server_available.signal
    }
    @reconnected_clb.call if @reconnected_clb != nil && socket_good?
  end
end