Don't wait for the whole server list before accepting connections
Blocking until all servers have been checked is safe, but significantly increases startup times. OTOH, we shouldn't accept connections unless we have at least one live server. So, a better approach may be to add the ability for `serversInfo.refresh()` to write to a channel after a live server has been found, and block on that channel in the main thread before accepting client connections.
This commit is contained in:
parent
3d5f877058
commit
d59d9427b3
|
@ -215,6 +215,7 @@ func (proxy *Proxy) StartProxy() {
|
|||
for _, registeredServer := range proxy.registeredServers {
|
||||
proxy.serversInfo.registerServer(registeredServer.name, registeredServer.stamp)
|
||||
}
|
||||
proxy.startAcceptingClients()
|
||||
liveServers, err := proxy.serversInfo.refresh(proxy)
|
||||
if liveServers > 0 {
|
||||
proxy.certIgnoreTimestamp = false
|
||||
|
@ -233,7 +234,6 @@ func (proxy *Proxy) StartProxy() {
|
|||
dlog.Error(err)
|
||||
dlog.Notice("dnscrypt-proxy is waiting for at least one server to be reachable")
|
||||
}
|
||||
proxy.startAcceptingClients()
|
||||
go func() {
|
||||
for {
|
||||
clocksmith.Sleep(PrefetchSources(proxy.xTransport, proxy.sources))
|
||||
|
|
Loading…
Reference in New Issue