Pull request: 3851 empty hosts

Merge in DNS/adguard-home from 3851-empty-hosts to master

Updates #3851.

Squashed commit of the following:

commit e09aa8e1029748ba162950b087336fd71677da2d
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Mon Nov 22 16:19:08 2021 +0300

    aghnet: imp code

commit c9e45148a68193249c2d7096a15c7fee571ba5bd
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Mon Nov 22 15:33:27 2021 +0300

    aghnet: fix hosts container empty engine
This commit is contained in:
Eugene Burkov 2021-11-22 17:22:59 +03:00
parent 9bac4b3db2
commit d41779cf88
1 changed files with 5 additions and 1 deletions

View File

@ -90,7 +90,6 @@ func NewHostsContainer(
engLock: &sync.RWMutex{},
done: make(chan struct{}, 1),
updates: make(chan *netutil.IPMap, 1),
last: &netutil.IPMap{},
fsys: fsys,
w: w,
patterns: patterns,
@ -347,6 +346,11 @@ func (hp *hostsParser) addPair(ip net.IP, host string) {
// equalSet returns true if the internal hosts table just parsed equals target.
func (hp *hostsParser) equalSet(target *netutil.IPMap) (ok bool) {
if target == nil {
// hp.table shouldn't appear nil since it's initialized on each refresh.
return target == hp.table
}
if hp.table.Len() != target.Len() {
return false
}