mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Change Request connection logic to try both IPv6 and IPv4 when available (#20108)
Fixes #19751
This commit is contained in:
parent
36b0ff57b7
commit
c989faaa62
@ -199,7 +199,8 @@ class Request
|
|||||||
rescue IPAddr::InvalidAddressError
|
rescue IPAddr::InvalidAddressError
|
||||||
Resolv::DNS.open do |dns|
|
Resolv::DNS.open do |dns|
|
||||||
dns.timeouts = 5
|
dns.timeouts = 5
|
||||||
addresses = dns.getaddresses(host).take(2)
|
addresses = dns.getaddresses(host)
|
||||||
|
addresses = addresses.filter { |addr| addr.is_a?(Resolv::IPv6) }.take(2) + addresses.filter { |addr| !addr.is_a?(Resolv::IPv6) }.take(2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user