From c90befd5a895d3673b3cd056dcfdfcab8297c0a4 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 14 Jan 2018 00:34:28 +0100 Subject: [PATCH] Fix getOne() --- dnscrypt-proxy/serversInfo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dnscrypt-proxy/serversInfo.go b/dnscrypt-proxy/serversInfo.go index 9a9cf704..b81cd1cc 100644 --- a/dnscrypt-proxy/serversInfo.go +++ b/dnscrypt-proxy/serversInfo.go @@ -104,7 +104,7 @@ func (serversInfo *ServersInfo) getOne() *ServerInfo { if serversInfo.inner[candidate].rtt.Value() < serversInfo.inner[0].rtt.Value() { serversInfo.inner[candidate], serversInfo.inner[0] = serversInfo.inner[0], serversInfo.inner[candidate] } - candidate = Min(serversCount, 2) + candidate = rand.Intn(Max(Min(serversCount, 2), len(serversInfo.inner))) serverInfo := &serversInfo.inner[candidate] return serverInfo }