From 84dd6a2c9078a70424f5b7a771f2c49b5d478ace Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Thu, 11 Dec 2014 12:43:00 +0000 Subject: Use getnameinfo rather than getaddrinfo --- lib/custodian/util/dns.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/custodian/util') 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 -- cgit v1.2.1