lib/httpx/resolver/resolver.rb in httpx-0.23.4 vs lib/httpx/resolver/resolver.rb in httpx-0.24.0

- old
+ new

@@ -44,17 +44,17 @@ def empty? true end - def emit_addresses(connection, family, addresses) + def emit_addresses(connection, family, addresses, early_resolve = false) addresses.map! do |address| address.is_a?(IPAddr) ? address : IPAddr.new(address.to_s) end - # double emission check - return if connection.addresses && !addresses.intersect?(connection.addresses) + # double emission check, but allow early resolution to work + return if !early_resolve && connection.addresses && !addresses.intersect?(connection.addresses) log { "resolver: answer #{FAMILY_TYPES[RECORD_TYPES[family]]} #{connection.origin.host}: #{addresses.inspect}" } if @pool && # if triggered by early resolve, pool may not be here yet !connection.io && connection.options.ip_families.size > 1 && @@ -85,10 +85,10 @@ addresses = addresses.select { |addr| addr.family == @family } return if addresses.empty? - emit_addresses(connection, @family, addresses) + emit_addresses(connection, @family, addresses, true) end def emit_resolve_error(connection, hostname = connection.origin.host, ex = nil) emit(:error, connection, resolve_error(hostname, ex)) end