Exemplo 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);
         }
     }
 }
Exemplo 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);
         }
     }
 }