Pull request 1936: fix-addr-proc

Merge in DNS/adguard-home from fix-addr-proc to master

Squashed commit of the following:

commit eb48be2aa4ceb27aa95c55034b35486d8f8d3c9e
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Fri Jul 21 14:43:04 2023 +0300

    dnsforward: rm redundant precaution

commit c58f1464e2c72b79724217f6ec1445da4a4ee5f5
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Fri Jul 21 14:40:09 2023 +0300

    all: revise the addr proc crutch

commit 8a01be9e1abe70268eff996460d2e56132462887
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Jul 20 20:05:54 2023 +0300

    dnsforward: fix tests panic
This commit is contained in:
Eugene Burkov 2023-07-24 15:11:11 +03:00
parent f9daf72c7e
commit ac2ecaf4f5
1 changed files with 12 additions and 5 deletions

View File

@ -562,9 +562,20 @@ func (s *Server) Prepare(conf *ServerConfig) (err error) {
s.recDetector.clear()
s.setupAddrProc()
s.registerHandlers()
return nil
}
// setupAddrProc initializes the address processor. For internal use only.
func (s *Server) setupAddrProc() {
// TODO(a.garipov): This is a crutch for tests; remove.
if s.conf.AddrProcConf == nil {
// TODO(a.garipov): This is a crutch for tests; remove.
s.conf.AddrProcConf = &client.DefaultAddrProcConfig{}
}
if s.conf.AddrProcConf.AddressUpdater == nil {
s.addrProc = client.EmptyAddrProc{}
} else {
c := s.conf.AddrProcConf
@ -579,10 +590,6 @@ func (s *Server) Prepare(conf *ServerConfig) (err error) {
// logic is moved to package client.
c.InitialAddresses = nil
}
s.registerHandlers()
return nil
}
// validateBlockingMode returns an error if the blocking mode data aren't valid.