diff options
-rw-r--r-- | lib/custodian/util/dns.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/custodian/util/dns.rb b/lib/custodian/util/dns.rb index a26cc96..e04361d 100644 --- a/lib/custodian/util/dns.rb +++ b/lib/custodian/util/dns.rb @@ -1,5 +1,6 @@ +require 'custodian/settings' require 'ipaddr' require 'socket' require 'timeout' @@ -21,8 +22,15 @@ module Custodian # def DNS.ip_to_hostname( ip ) resolved = nil + + # + # Get the timeout period. + # + settings = Custodian::Settings.instance() + period = settings.timeout() + begin - timeout( 4 ) do + timeout( period ) do begin Socket.getaddrinfo(ip, 'echo').each do |a| resolved = a[2] if ( a ) @@ -45,8 +53,14 @@ module Custodian resolved = nil + # + # Get the timeout period. + # + settings = Custodian::Settings.instance() + period = settings.timeout() + begin - timeout( 4 ) do + timeout( period ) do begin Socket.getaddrinfo(hostname, 'echo').each do |a| resolved = a[3] if ( a ) |