Merge: - blocked-services: settings were reset on restart

Close #1624

Squashed commit of the following:

commit eecc91ca1f9d062c27702a9c07da74da673bef05
Merge: ec53dbeb 26f78dcc
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Apr 27 13:15:58 2020 +0300

    Merge remote-tracking branch 'origin/master' into fix-blocked-svcs

commit ec53dbebdc2fbd2ff94f939d2bd8fb07b9dd1bc8
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Apr 27 12:58:50 2020 +0300

    minor

commit 1e3c20ed02151965ebaca55ac4f25a951a772062
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Mon Apr 27 12:53:37 2020 +0300

    - blocked-services: settings were reset on restart

    broken by:
     0789e4b20d
     * refactor: move blocked-services functions to dnsfilter
This commit is contained in:
Simon Zolin 2020-04-27 13:21:16 +03:00
parent 26f78dcc65
commit 14ffd1a3f5
2 changed files with 10 additions and 2 deletions

View File

@ -628,6 +628,11 @@ func makeResult(rule rules.Rule, reason Reason) Result {
return res
}
// InitModule() - manually initialize blocked services map
func InitModule() {
initBlockedServices()
}
// New creates properly initialized DNS Filter that is ready to be used
func New(c *Config, blockFilters []Filter) *Dnsfilter {
@ -677,8 +682,6 @@ func New(c *Config, blockFilters []Filter) *Dnsfilter {
}
d.BlockedServices = bsvcs
initBlockedServices()
if blockFilters != nil {
err := d.initFiltering(nil, blockFilters)
if err != nil {

View File

@ -208,6 +208,11 @@ func run(args options) {
}
}
// 'clients' module uses 'dnsfilter' module's static data (dnsfilter.BlockedSvcKnown()),
// so we have to initialize dnsfilter's static data first,
// but also avoid relying on automatic Go init() function
dnsfilter.InitModule()
config.DHCP.WorkDir = Context.workDir
config.DHCP.HTTPRegister = httpRegister
config.DHCP.ConfigModified = onConfigModified