lib/httpx/resolver/https.rb in httpx-1.3.0 vs lib/httpx/resolver/https.rb in httpx-1.3.1
- old
+ new
@@ -69,13 +69,15 @@
@resolver_connection ||= @pool.find_connection(@uri, @options) || begin
@building_connection = true
connection = @options.connection_class.new(@uri, @options.merge(ssl: { alpn_protocols: %w[h2] }))
@pool.init_connection(connection, @options)
# only explicity emit addresses if connection didn't pre-resolve, i.e. it's not an IP.
- emit_addresses(connection, @family, @uri_addresses) unless connection.addresses
- @building_connection = false
- connection
+ catch(:coalesced) do
+ @building_connection = false
+ emit_addresses(connection, @family, @uri_addresses) unless connection.addresses
+ connection
+ end
end
end
private
@@ -197,10 +199,10 @@
# eliminate other candidates
@queries.delete_if { |_, conn| connection == conn }
Resolver.cached_lookup_set(hostname, @family, addresses) if @resolver_options[:cache]
- emit_addresses(connection, @family, addresses.map { |addr| addr["data"] })
+ catch(:coalesced) { emit_addresses(connection, @family, addresses.map { |addr| addr["data"] }) }
end
end
return if @connections.empty?
resolve