better limit adjustment for relay discovery

This commit is contained in:
vyzo 2018-10-19 15:56:45 +03:00
parent 8faf5403c5
commit b62c83bd5c
1 changed files with 2 additions and 1 deletions

View File

@ -116,7 +116,8 @@ func (h *AutoRelayHost) findRelays(ctx context.Context) {
h.mx.Unlock() h.mx.Unlock()
limit := 20 limit := 20
for ; need > limit; limit *= 2 { if need > limit/2 {
limit = 2 * need
} }
dctx, cancel := context.WithTimeout(ctx, 60*time.Second) dctx, cancel := context.WithTimeout(ctx, 60*time.Second)