* refactor: don't set new configuration while running DNS server

This commit is contained in:
Simon Zolin 2019-07-22 12:52:27 +03:00
parent 5a3de2a276
commit fdf7ee2c08
1 changed files with 6 additions and 6 deletions

View File

@ -177,15 +177,11 @@ func processIPCIDRArray(dst *map[string]bool, dstIPNet *[]net.IPNet, src []strin
// startInternal starts without locking
func (s *Server) startInternal(config *ServerConfig) error {
if config != nil {
s.conf = *config
}
if s.dnsFilter != nil || s.dnsProxy != nil {
return errors.New("DNS server is already started")
}
err := s.initDNSFilter()
err := s.initDNSFilter(config)
if err != nil {
return err
}
@ -246,9 +242,13 @@ func (s *Server) startInternal(config *ServerConfig) error {
}
// Initializes the DNS filter
func (s *Server) initDNSFilter() error {
func (s *Server) initDNSFilter(config *ServerConfig) error {
log.Tracef("Creating dnsfilter")
if config != nil {
s.conf = *config
}
var filters map[int]string
filters = nil
if s.conf.FilteringEnabled {