From e67fe89adb35fa2eb4afb54afc98515ea97c895d Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Thu, 5 Dec 2024 13:03:11 +0100 Subject: [PATCH] Reduce max wait time to initialize peer connections (#2984) * Reduce max wait time to initialize peer connections setting rand time range to 100-300ms instead of 100-800ms * remove min wait time --- client/internal/peer/conn.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/client/internal/peer/conn.go b/client/internal/peer/conn.go index a8de2fccb..3a698a82a 100644 --- a/client/internal/peer/conn.go +++ b/client/internal/peer/conn.go @@ -597,9 +597,8 @@ func (conn *Conn) doOnConnected(remoteRosenpassPubKey []byte, remoteRosenpassAdd } func (conn *Conn) waitInitialRandomSleepTime(ctx context.Context) { - minWait := 100 - maxWait := 800 - duration := time.Duration(rand.Intn(maxWait-minWait)+minWait) * time.Millisecond + maxWait := 300 + duration := time.Duration(rand.Intn(maxWait)) * time.Millisecond timeout := time.NewTimer(duration) defer timeout.Stop()