From b62c83bd5cf1fdcc9507a87ca3a1f6f4b4b70f34 Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 19 Oct 2018 15:56:45 +0300 Subject: [PATCH] better limit adjustment for relay discovery --- p2p/host/relay/autorelay.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/p2p/host/relay/autorelay.go b/p2p/host/relay/autorelay.go index 1302079..8d8302d 100644 --- a/p2p/host/relay/autorelay.go +++ b/p2p/host/relay/autorelay.go @@ -116,7 +116,8 @@ func (h *AutoRelayHost) findRelays(ctx context.Context) { h.mx.Unlock() limit := 20 - for ; need > limit; limit *= 2 { + if need > limit/2 { + limit = 2 * need } dctx, cancel := context.WithTimeout(ctx, 60*time.Second) -- GitLab