DnsWebService: Updated block list timer initial interval to 5 sec so that settings get applied quickly. Flushing blocked zone when block list settings are updated. Added missing save block zone file after flushing.

This commit is contained in:
Shreyas Zare
2018-09-22 15:40:21 +05:30
parent 821d4166c4
commit 5bacfe7ab5

View File

@@ -74,7 +74,7 @@ namespace DnsServerCore
Uri _blockListUrl;
DateTime _blockListLastUpdatedOn;
const int BLOCK_LIST_UPDATE_AFTER_HOURS = 24;
const int BLOCK_LIST_UPDATE_TIMER_INITIAL_INTERVAL = 60000;
const int BLOCK_LIST_UPDATE_TIMER_INITIAL_INTERVAL = 5000;
const int BLOCK_LIST_UPDATE_TIMER_INTERVAL = 900000;
#endregion
@@ -885,12 +885,18 @@ namespace DnsServerCore
if (strBlockListUrl == "false")
{
StopBlockListUpdateTimer();
FlushBlockedZone(request);
_blockListUrl = null;
}
else if ((_blockListUrl == null) || !_blockListUrl.AbsoluteUri.Equals(strBlockListUrl))
{
_blockListUrl = new Uri(strBlockListUrl);
_blockListLastUpdatedOn = new DateTime();
StopBlockListUpdateTimer();
FlushBlockedZone(request);
StartBlockListUpdateTimer();
}
}
@@ -1049,6 +1055,8 @@ namespace DnsServerCore
_dnsServer.BlockedZoneRoot.Flush();
_log.Write(GetRequestRemoteEndPoint(request), "[" + GetSession(request).Username + "] Blocked zone was flushed.");
SaveBlockedZoneFile();
}
private void DeleteBlockedZone(HttpListenerRequest request)