Esempio n. 1
0
 private void UpdateDnsServersIfNeeded()
 {
     if ((IPBanService.UtcNow - lastDnsServersUpdate) > dnsServerUpdateInterval)
     {
         try
         {
             dnsServers           = new HashSet <IPAddress>(NetworkUtility.GetLocalDnsServers());
             lastDnsServersUpdate = IPBanService.UtcNow;
         }
         catch (Exception ex)
         {
             Logger.Error(ex);
         }
     }
 }
Esempio n. 2
0
 private void UpdateDnsServersIfNeeded()
 {
     if ((IPBanService.UtcNow - lastDnsServersUpdate) > dnsServerUpdateInterval)
     {
         try
         {
             HashSet <IPAddress> newDnsServers = new HashSet <IPAddress>(NetworkUtility.GetLocalDnsServers());
             foreach (var ip in Dns.GetHostAddresses(Dns.GetHostName()))
             {
                 newDnsServers.Add(ip);
             }
             dnsServers           = newDnsServers;
             lastDnsServersUpdate = IPBanService.UtcNow;
         }
         catch (Exception ex)
         {
             Logger.Error(ex);
         }
     }
 }