From b524aa67de90612da099a11297936f9a75e7d4fd Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Tue, 30 Mar 2021 15:53:55 +0200 Subject: [PATCH] add debug print in timeout ping update --- include/Client.h | 2 ++ src/Client.cpp | 3 ++- src/TNetwork.cpp | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/Client.h b/include/Client.h index cbf3748..f00f079 100644 --- a/include/Client.h +++ b/include/Client.h @@ -22,6 +22,8 @@ public: }; explicit TClient(TServer& Server); + TClient(const TClient&) = delete; + TClient& operator=(const TClient&) = delete; void AddNewCar(int Ident, const std::string& Data); void SetCarData(int Ident, const std::string& Data); diff --git a/src/Client.cpp b/src/Client.cpp index d9636f9..6f07966 100644 --- a/src/Client.cpp +++ b/src/Client.cpp @@ -69,7 +69,7 @@ TServer& TClient::Server() const { return mServer; } -void TClient::EnqueueMissedPacketDuringSyncing(const std::string& Packet){ +void TClient::EnqueueMissedPacketDuringSyncing(const std::string& Packet) { std::unique_lock Lock(mMissedPacketsMutex); mMissedPacketsDuringSyncing.push(Packet); } @@ -81,6 +81,7 @@ TClient::TClient(TServer& Server) void TClient::UpdatePingTime() { mLastPingTime = std::chrono::high_resolution_clock::now(); + debug(std::string("ping time updated!: ") + ((SecondsSinceLastPing() == 0) ? "OK" : "ERR")); } int TClient::SecondsSinceLastPing() { auto seconds = std::chrono::duration_cast( diff --git a/src/TNetwork.cpp b/src/TNetwork.cpp index 4f5f9e1..8a193b3 100644 --- a/src/TNetwork.cpp +++ b/src/TNetwork.cpp @@ -489,7 +489,8 @@ void TNetwork::TCPClient(const std::weak_ptr& c) { if (c.expired()) break; auto Client = c.lock(); - if (Client->GetStatus() <= -1) { + if (Client->GetStatus() < 0) { + debug("client status < 0, breaking client loop"); break; } TServer::GlobalParser(c, TCPRcv(*Client), mPPSMonitor, *this);