]> projects.mako.cc - selectricity-live/blobdiff - lib/whois/whois.rb
Fix host truncation to work correctly
[selectricity-live] / lib / whois / whois.rb
index 88c735ba4f4309a0d3746646f4bc5ad731c69263..7cc6e9d1eea43efef502e6ac0d4ea406f156b440 100755 (executable)
@@ -4,6 +4,8 @@ require 'socket'
 require 'resolv'
 require 'ipaddr'
 require 'yaml'
+require 'timeout'
+
 require File.dirname(__FILE__) + '/server/server'
 
 # Module for manage all Whois Class
@@ -92,7 +94,11 @@ module Whois
         def search_host
             begin
                 if @host_search
-                    @host = Resolv.getname self.ip.to_s
+                   begin
+                     timeout(5) {@host = Resolv.getname self.ip.to_s}
+                   rescue Timeout::Error
+                     @host=nil
+                   end
                 else
                     @host = nil
                 end

Benjamin Mako Hill || Want to submit a patch?