add debug print in timeout ping update

This commit is contained in:
Lion Kortlepel 2021-03-30 15:53:55 +02:00
parent e35d1b5457
commit b524aa67de
3 changed files with 6 additions and 2 deletions

View File

@ -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);

View File

@ -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<std::chrono::seconds>(

View File

@ -489,7 +489,8 @@ void TNetwork::TCPClient(const std::weak_ptr<TClient>& 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);