- filters: start DNS server after filters are updated
This commit is contained in:
parent
87ccd192c3
commit
1b45dc45fc
|
@ -215,11 +215,18 @@ func refreshFiltersIfNecessary(force bool) int {
|
||||||
}
|
}
|
||||||
uf.LastUpdated = time.Now()
|
uf.LastUpdated = time.Now()
|
||||||
updateFlags = append(updateFlags, updated)
|
updateFlags = append(updateFlags, updated)
|
||||||
|
if updated {
|
||||||
|
updateCount++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isRunning := isRunning()
|
stopped := false
|
||||||
_ = dnsServer.Stop()
|
if updateCount != 0 {
|
||||||
|
_ = dnsServer.Stop()
|
||||||
|
stopped = true
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCount = 0
|
||||||
for i := range updateFilters {
|
for i := range updateFilters {
|
||||||
uf := &updateFilters[i]
|
uf := &updateFilters[i]
|
||||||
updated := updateFlags[i]
|
updated := updateFlags[i]
|
||||||
|
@ -259,7 +266,7 @@ func refreshFiltersIfNecessary(force bool) int {
|
||||||
config.Unlock()
|
config.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
if updateCount > 0 && isRunning {
|
if stopped {
|
||||||
err := reconfigureDNSServer()
|
err := reconfigureDNSServer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("cannot reconfigure DNS server with the new filters: %s", err)
|
log.Error("cannot reconfigure DNS server with the new filters: %s", err)
|
||||||
|
|
Loading…
Reference in New Issue