- DNS: fix slow response to /status and /access/list requests

This commit is contained in:
Simon Zolin
2019-12-17 13:09:03 +03:00
parent 04de9d0f7b
commit 8521635f63
4 changed files with 7 additions and 7 deletions

View File

@@ -119,13 +119,13 @@ type accessListJSON struct {
}
func (s *Server) handleAccessList(w http.ResponseWriter, r *http.Request) {
s.Lock()
s.RLock()
j := accessListJSON{
AllowedClients: s.conf.AllowedClients,
DisallowedClients: s.conf.DisallowedClients,
BlockedHosts: s.conf.BlockedHosts,
}
s.Unlock()
s.RUnlock()
w.Header().Set("Content-Type", "application/json")
err := json.NewEncoder(w).Encode(j)

View File

@@ -94,7 +94,7 @@ func stringArrayDup(a []string) []string {
// WriteDiskConfig - write configuration
func (s *Server) WriteDiskConfig(c *FilteringConfig) {
s.Lock()
s.RLock()
sc := s.conf.FilteringConfig
*c = sc
c.RatelimitWhitelist = stringArrayDup(sc.RatelimitWhitelist)
@@ -103,7 +103,7 @@ func (s *Server) WriteDiskConfig(c *FilteringConfig) {
c.DisallowedClients = stringArrayDup(sc.DisallowedClients)
c.BlockedHosts = stringArrayDup(sc.BlockedHosts)
c.UpstreamDNS = stringArrayDup(sc.UpstreamDNS)
s.Unlock()
s.RUnlock()
}
// FilteringConfig represents the DNS filtering configuration of AdGuard Home