From f89ec937d4a2b7fa48602992a5d5cec4ee2fc014 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sat, 30 Mar 2024 02:57:59 +0100 Subject: [PATCH] Tier2: only enforce retry timer on (state == CS_RETRY) Fixes a bug where the initial connect is only initiated after lastQueryTime + params.retryTime seconds. --- src/tier2/websocket.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/tier2/websocket.cpp b/src/tier2/websocket.cpp index 405b9882..f202e971 100644 --- a/src/tier2/websocket.cpp +++ b/src/tier2/websocket.cpp @@ -208,11 +208,14 @@ bool CWebSocket::IsInitialized() const //----------------------------------------------------------------------------- bool CWebSocket::ConnContext_s::Connect(const double queryTime, const ConnParams_s& params) { - const double retryTimeTotal = lastQueryTime + params.retryTime; - const double currTime = Plat_FloatTime(); + if (state == CS_RETRY) + { + const double retryTimeTotal = lastQueryTime + params.retryTime; + const double currTime = Plat_FloatTime(); - if (retryTimeTotal > currTime) - return false; // Still within retry period + if (retryTimeTotal > currTime) + return false; // Still within retry period + } tryCount++; webSocket = ProtoWebSocketCreate(params.bufSize);