From 30331e8f62d9597f3858c2ac7a26a6f2d6beb14b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Papp?= Date: Thu, 11 Jul 2024 15:37:07 +0200 Subject: [PATCH] Change random wait time --- client/internal/peer/conn.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/internal/peer/conn.go b/client/internal/peer/conn.go index b6519d278..39c4b9af3 100644 --- a/client/internal/peer/conn.go +++ b/client/internal/peer/conn.go @@ -372,6 +372,10 @@ func (conn *Conn) reconnectLoopWithRetry() { } } +// reconnectLoopForOnDisconnectedEvent is used when the peer is not a controller and it should reconnect to the peer +// when the connection is lost. It will try to establish a connection only once time if before the connection was established +// It track separately the ice and relay connection status. Just because a lover priority connection reestablished it does not +// mean that to switch to it. We always force to use the higher priority connection. func (conn *Conn) reconnectLoopForOnDisconnectedEvent() { for { select { @@ -679,8 +683,8 @@ func (conn *Conn) doHandshake() error { } func (conn *Conn) waitInitialRandomSleepTime() { - minWait := 500 - maxWait := 2000 + minWait := 100 + maxWait := 800 duration := time.Duration(rand.Intn(maxWait-minWait)+minWait) * time.Millisecond timeout := time.NewTimer(duration)