From 1b45dc45fc4e610689afc4e618e45ed946f02646 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Tue, 16 Jul 2019 14:32:58 +0300 Subject: [PATCH] - filters: start DNS server after filters are updated --- home/filter.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/home/filter.go b/home/filter.go index 2a56a847..5f908875 100644 --- a/home/filter.go +++ b/home/filter.go @@ -215,11 +215,18 @@ func refreshFiltersIfNecessary(force bool) int { } uf.LastUpdated = time.Now() updateFlags = append(updateFlags, updated) + if updated { + updateCount++ + } } - isRunning := isRunning() - _ = dnsServer.Stop() + stopped := false + if updateCount != 0 { + _ = dnsServer.Stop() + stopped = true + } + updateCount = 0 for i := range updateFilters { uf := &updateFilters[i] updated := updateFlags[i] @@ -259,7 +266,7 @@ func refreshFiltersIfNecessary(force bool) int { config.Unlock() } - if updateCount > 0 && isRunning { + if stopped { err := reconfigureDNSServer() if err != nil { log.Error("cannot reconfigure DNS server with the new filters: %s", err)