Skip to content

Commit

Permalink
Merge: - filters: start DNS server after filters are updated
Browse files Browse the repository at this point in the history
Close #886

* commit '1b45dc45fc4e610689afc4e618e45ed946f02646':
  - filters: start DNS server after filters are updated
  • Loading branch information
szolin committed Jul 16, 2019
2 parents 87ccd19 + 1b45dc4 commit 55a4536
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions home/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 55a4536

Please sign in to comment.