lib/httpx/resolver/https.rb in httpx-0.17.0 vs lib/httpx/resolver/https.rb in httpx-0.18.0
- old
+ new
@@ -22,12 +22,14 @@
uri: NAMESERVER,
use_get: false,
record_types: RECORD_TYPES.keys,
}.freeze
- def_delegators :@resolver_connection, :connecting?, :to_io, :call, :close
+ def_delegators :@resolver_connection, :state, :connecting?, :to_io, :call, :close
+ attr_writer :pool
+
def initialize(options)
@options = Options.new(options)
@resolver_options = DEFAULTS.merge(@options.resolver_options)
@_record_types = Hash.new { |types, host| types[host] = @resolver_options[:record_types].dup }
@queries = {}
@@ -61,18 +63,14 @@
true
end
private
- def pool
- Thread.current[:httpx_connection_pool] ||= Pool.new
- end
-
def resolver_connection
- @resolver_connection ||= pool.find_connection(@uri, @options) || begin
+ @resolver_connection ||= @pool.find_connection(@uri, @options) || begin
@building_connection = true
connection = @options.connection_class.new("ssl", @uri, @options.merge(ssl: { alpn_protocols: %w[h2] }))
- pool.init_connection(connection, @options)
+ @pool.init_connection(connection, @options)
emit_addresses(connection, @uri_addresses)
@building_connection = false
connection
end
end