lib/httpx/resolver/https.rb in httpx-0.7.0 vs lib/httpx/resolver/https.rb in httpx-0.8.0

- old
+ new

@@ -23,11 +23,11 @@ use_get: false, }.freeze def_delegator :@connections, :empty? - def_delegators :@resolver_connection, :to_io, :call, :interests, :close + def_delegators :@resolver_connection, :connecting?, :to_io, :call, :close def initialize(options) @options = Options.new(options) @resolver_options = Resolver::Options.new(DEFAULTS.merge(@options.resolver_options || {})) @_record_types = Hash.new { |types, host| types[host] = RECORD_TYPES.keys.dup } @@ -60,12 +60,24 @@ return true unless @resolver_connection resolver_connection.closed? end + def interests + return if @queries.empty? + + resolver_connection.__send__(__method__) + end + private + def connect + return if @queries.empty? + + resolver_connection.__send__(__method__) + end + def pool Thread.current[:httpx_connection_pool] ||= Pool.new end def resolver_connection @@ -82,11 +94,11 @@ def resolve(connection = @connections.first, hostname = nil) return if @building_connection hostname = hostname || @queries.key(connection) || connection.origin.host type = @_record_types[hostname].first - log(label: "resolver: ") { "query #{type} for #{hostname}" } + log { "resolver: query #{type} for #{hostname}" } begin request = build_request(hostname, type) @requests[request] = connection resolver_connection.send(request) @queries[hostname] = connection @@ -109,10 +121,10 @@ ensure @requests.delete(request) end def on_promise(_, stream) - log(level: 2, label: "#{stream.id}: ") { "refusing stream!" } + log(level: 2) { "#{stream.id}: refusing stream!" } stream.refuse end def parse(response) begin