- DNS: fix slow response to /status and /access/list requests
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user