Bug #12604

Updated by nobu (Nobuyoshi Nakada) about 7 years ago

`Win32::Resolv.get_resolv_info` Win32::Resolv.get_resolv_info returns a list of IP address that include DNS server for network devices that are not connected, causing long timeouts when using `Resolv::DNS` Resolv::DNS (or Rubygems which uses `Resolv::DNS`) Resolv::DNS) 

 `Win32::Resolv` Win32::Resolv scans the registry for DNS server addresses. Unfortunatly, if some of your network devices are not currently connected, the old DNS information is still stored in registry. So `get_resolv_info` get_resolv_info still returns it. This can cause very long timeouts when using `Resolv::DNS` Resolv::DNS (e.g. rubygems). For example, a simple 'gem install' on my machine would take over a minute, because of several timeouts waiting for DNS. 


 ```ruby <pre> 
 irb(main):024:0> Win32::Resolv.get_resolv_info 
 => [["mynet", "mycompany.local", "local"], ["", "", "", "", "", ""]] 
 ``` </pre> 

 * is the DNS server from my home Wifi (not currently connected) 
 * is the DNS server from a router I had connected via an USB Ethernet Device a week ago 
 * is from the same as above (but incidentally works, since it is available) 
 * are the actual current DNS server 

 I think a solution could be to rely on `GetAdapterAddresses()` GetAdapterAddresses() in the Win32 API instead to get the IP address of DNS server. 

 As a workaround for users affected by this is to remove unconnected Interfaces from `HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces` HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces in the registry.