cherry-pick: all: do not check local domains when dhcp srv is off

Updates #3028.

Squashed commit of the following:

commit 49d3ca5c9de0468ccb1792e9de263fd66e30d79c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Apr 29 15:35:32 2021 +0300

    all: do not check local domains when dhcp srv is off
This commit is contained in:
Ainar Garipov
2021-04-29 16:00:07 +03:00
committed by Ainar Garipov
parent 351d793b96
commit ee3b34ecb1
6 changed files with 30 additions and 6 deletions

View File

@@ -133,6 +133,7 @@ type Server struct {
// ServerInterface is an interface for servers.
type ServerInterface interface {
Enabled() (ok bool)
Leases(flags int) []Lease
SetOnLeaseChanged(onLeaseChanged OnLeaseChangedT)
}
@@ -207,6 +208,11 @@ func Create(conf ServerConfig) *Server {
return s
}
// Enabled returns true when the server is enabled.
func (s *Server) Enabled() (ok bool) {
return s.conf.Enabled
}
// server calls this function after DB is updated
func (s *Server) onNotify(flags uint32) {
if flags == LeaseChangedDBStore {