Avoid infinite blocking

Cover `offline_mode`.
This commit is contained in:
YX Hao 2023-12-12 19:02:41 +08:00
parent 1658efb256
commit a089d171b4

View file

@ -245,7 +245,9 @@ func (serversInfo *ServersInfo) refresh(proxy *Proxy) (int, error) {
}
}(&registeredServers[i])
}
<-waitChannel
if len(registeredServers) > 0 {
<-waitChannel
}
serversInfo.Lock()
sort.SliceStable(serversInfo.inner, func(i, j int) bool {
return serversInfo.inner[i].initialRtt < serversInfo.inner[j].initialRtt