summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2014-12-11 12:43:00 +0000
committerPatrick J Cherry <patrick@bytemark.co.uk>2014-12-11 12:43:00 +0000
commit84dd6a2c9078a70424f5b7a771f2c49b5d478ace (patch)
treefcca21d82a3ed4f45a4499d26a69f76d00b4e128
parent4027be405e40e9a625d87a431bd7c8cdf922877f (diff)
Use getnameinfo rather than getaddrinfo
-rw-r--r--lib/custodian/util/dns.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/custodian/util/dns.rb b/lib/custodian/util/dns.rb
index e04361d..82a7e68 100644
--- a/lib/custodian/util/dns.rb
+++ b/lib/custodian/util/dns.rb
@@ -32,9 +32,7 @@ module Custodian
begin
timeout( period ) do
begin
- Socket.getaddrinfo(ip, 'echo').each do |a|
- resolved = a[2] if ( a )
- end
+ resolved = Socket.getnameinfo(Socket.sockaddr_in(80, ip) ).first
rescue SocketError
resolved = nil
end