mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-04-01 15:03:30 +03:00
- DNS: fix race in WriteDiskConfig()
This commit is contained in:
parent
000e842f7b
commit
ef57f7e192
1 changed files with 14 additions and 1 deletions
|
@ -86,10 +86,23 @@ func (s *Server) Close() {
|
||||||
s.Unlock()
|
s.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func stringArrayDup(a []string) []string {
|
||||||
|
a2 := make([]string, len(a))
|
||||||
|
copy(a2, a)
|
||||||
|
return a2
|
||||||
|
}
|
||||||
|
|
||||||
// WriteDiskConfig - write configuration
|
// WriteDiskConfig - write configuration
|
||||||
func (s *Server) WriteDiskConfig(c *FilteringConfig) {
|
func (s *Server) WriteDiskConfig(c *FilteringConfig) {
|
||||||
s.Lock()
|
s.Lock()
|
||||||
*c = s.conf.FilteringConfig
|
sc := s.conf.FilteringConfig
|
||||||
|
*c = sc
|
||||||
|
c.RatelimitWhitelist = stringArrayDup(sc.RatelimitWhitelist)
|
||||||
|
c.BootstrapDNS = stringArrayDup(sc.BootstrapDNS)
|
||||||
|
c.AllowedClients = stringArrayDup(sc.AllowedClients)
|
||||||
|
c.DisallowedClients = stringArrayDup(sc.DisallowedClients)
|
||||||
|
c.BlockedHosts = stringArrayDup(sc.BlockedHosts)
|
||||||
|
c.UpstreamDNS = stringArrayDup(sc.UpstreamDNS)
|
||||||
s.Unlock()
|
s.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue