lib/proxymachine/client_connection.rb in fizx-proxymachine-1.5.1 vs lib/proxymachine/client_connection.rb in fizx-proxymachine-1.5.2

- old
+ new

@@ -74,11 +74,11 @@ # Connect to the remote server def connect_to_server fail "connect_server called without remote established" if @remote.nil? host, port = @remote - $logger.info "Establishing new connection with #{host}:#{port}" + $logger.info "Establishing new connection with #{host}:#{port} OHAI" cb = @commands[:callback] klass = cb ? CallbackServerConnection : ServerConnection @server_side = klass.request(host, port, self) @server_side.callback = cb if cb @server_side.pending_connect_timeout = @connect_timeout @@ -105,10 +105,10 @@ @server_side = nil if @connected $logger.error "Connection with #{@remote.join(':')} was terminated prematurely." close_connection (@connect_error_callback || ProxyMachine.connect_error_callback).call(@remote.join(':')) - elsif @tries < 10 + elsif @tries < 2 @tries += 1 $logger.warn "Retrying connection with #{@remote.join(':')} (##{@tries})" EM.add_timer(0.1) { connect_to_server } else $logger.error "Connect #{@remote.join(':')} failed after ten attempts."