mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2024-11-09 16:56:37 +03:00
Use registeredServers slice copy during ServerInfo refreshing period (#2125)
goroutines: proxy.updateRegisteredServers() versus proxy.serversInfo.refresh(proxy)
This commit is contained in:
parent
8d737a69f5
commit
6916c047e1
@ -223,7 +223,9 @@ func (serversInfo *ServersInfo) refreshServer(proxy *Proxy, name string, stamp s
|
||||
func (serversInfo *ServersInfo) refresh(proxy *Proxy) (int, error) {
|
||||
dlog.Debug("Refreshing certificates")
|
||||
serversInfo.RLock()
|
||||
registeredServers := serversInfo.registeredServers
|
||||
// Appending registeredServers slice from sources may allocate new memory.
|
||||
registeredServers := make([]RegisteredServer, len(serversInfo.registeredServers))
|
||||
copy(registeredServers, serversInfo.registeredServers)
|
||||
serversInfo.RUnlock()
|
||||
liveServers := 0
|
||||
var err error
|
||||
|
Loading…
Reference in New Issue
Block a user