lib/fluent/plugin/output_node.rb in fluent-plugin-secure-forward-0.4.2 vs lib/fluent/plugin/output_node.rb in fluent-plugin-secure-forward-0.4.3

- old
+ new

@@ -164,11 +164,11 @@ # ['PONG', bool(authentication result), 'reason if authentication failed', # self_hostname, sha512\_hex(salt + self_hostname + nonce + sharedkey)] unless message.size == 5 && message[0] == 'PONG' return false, 'invalid format for PONG message' end - pong, auth_result, reason, hostname, shared_key_hexdigest = message + _pong, auth_result, reason, hostname, shared_key_hexdigest = message unless auth_result return false, 'authentication failed: ' + reason end @@ -225,11 +225,17 @@ def connect Thread.current.abort_on_exception = true log.debug "starting client" - addr = @sender.hostname_resolver.getaddress(@host) - log.debug "create tcp socket to node", host: @host, address: addr, port: @port + begin + addr = @sender.hostname_resolver.getaddress(@host) + log.debug "create tcp socket to node", host: @host, address: addr, port: @port + rescue => e + log.warn "failed to resolve the hostname", error_class: e.class, error: e, host: @host + @state = :failed + return + end begin if @proxy_uri.nil? then sock = TCPSocket.new(addr, @port) else