From 9f47978f0f491d93f9c51838e00336b59353b8c0 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Sat, 11 May 2024 12:17:02 +0200 Subject: [PATCH 1/2] use hard disconnect insteadof clientkick --- src/TPPSMonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TPPSMonitor.cpp b/src/TPPSMonitor.cpp index b891a22..461dfbf 100644 --- a/src/TPPSMonitor.cpp +++ b/src/TPPSMonitor.cpp @@ -76,7 +76,7 @@ void TPPSMonitor::operator()() { return true; }); for (auto& ClientToKick : TimedOutClients) { - Network().ClientKick(*ClientToKick, "Timeout (no ping for way too long)"); + ClientToKick->Disconnect("Timeout"); } TimedOutClients.clear(); if (C == 0 || mInternalPPS == 0) { From fcd408970be04547bc3c341da1fca9e36ff824e4 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Sat, 11 May 2024 12:44:41 +0200 Subject: [PATCH 2/2] always initialize ping timer --- include/Client.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/Client.h b/include/Client.h index 63f0316..898a0a9 100644 --- a/include/Client.h +++ b/include/Client.h @@ -128,7 +128,7 @@ private: std::string mRole; std::string mDID; int mID = -1; - std::chrono::time_point mLastPingTime; + std::chrono::time_point mLastPingTime = std::chrono::high_resolution_clock::now(); }; std::optional> GetClient(class TServer& Server, int ID);