From 5bacfe7ab5bcdc8ce840e04b0ef2bdd5de8add72 Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 22 Sep 2018 15:40:21 +0530 Subject: [PATCH] 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. --- DnsServerCore/DnsWebService.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/DnsServerCore/DnsWebService.cs b/DnsServerCore/DnsWebService.cs index 111ded79..a0f02ed3 100644 --- a/DnsServerCore/DnsWebService.cs +++ b/DnsServerCore/DnsWebService.cs @@ -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)