Repair server randomization
This commit is contained in:
parent
5398dab58e
commit
7ec5ed127e
|
@ -806,10 +806,15 @@ func (config *Config) loadSources(proxy *Proxy) error {
|
||||||
}
|
}
|
||||||
proxy.registeredServers = append(proxy.registeredServers, RegisteredServer{name: serverName, stamp: stamp})
|
proxy.registeredServers = append(proxy.registeredServers, RegisteredServer{name: serverName, stamp: stamp})
|
||||||
}
|
}
|
||||||
rand.Shuffle(len(proxy.registeredServers), func(i, j int) {
|
|
||||||
proxy.registeredServers[i], proxy.registeredServers[j] = proxy.registeredServers[j], proxy.registeredServers[i]
|
|
||||||
})
|
|
||||||
proxy.updateRegisteredServers()
|
proxy.updateRegisteredServers()
|
||||||
|
rs1 := proxy.registeredServers
|
||||||
|
rs2 := proxy.serversInfo.registeredServers
|
||||||
|
rand.Shuffle(len(rs1), func(i, j int) {
|
||||||
|
rs1[i], rs1[j] = rs1[j], rs1[i]
|
||||||
|
})
|
||||||
|
rand.Shuffle(len(rs2), func(i, j int) {
|
||||||
|
rs2[i], rs2[j] = rs2[j], rs2[i]
|
||||||
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -348,7 +348,6 @@ func (proxy *Proxy) updateRegisteredServers() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
for _, registeredServer := range proxy.registeredServers {
|
for _, registeredServer := range proxy.registeredServers {
|
||||||
proxy.serversInfo.registerServer(registeredServer.name, registeredServer.stamp)
|
proxy.serversInfo.registerServer(registeredServer.name, registeredServer.stamp)
|
||||||
|
|
Loading…
Reference in New Issue