Skip to content
Snippets Groups Projects
Verified Commit bbf50574 authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Use resolv instead of ipsocket to get WDS address

parent ff7b3136
No related branches found
No related tags found
No related merge requests found
......@@ -111,9 +111,9 @@ class WdsServer < ApplicationRecord
end
def next_server_ip
IPSocket.getaddress URI(url).host
rescue SocketError
::Rails.logger.info "Failed to look up IP of WDS server #{name}"
Resolv.getaddresses(URI(url).host).select { |str| IPAddr.new(str).ipv4? }.first
rescue Resolv::ResolvError => e
::Rails.logger.info "Failed to look up IP of WDS server #{name}. #{e.class}: #{e}"
nil
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment