Fix timeout for synced players (#289)

Fix: #275.

While I was at it, I also refactored the debug output so its more
appealing to read.

I dont see further ways to improve on this currently.
This commit is contained in:
Lion 2024-05-06 12:02:31 +02:00 committed by GitHub
commit 3b5c6491a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,10 +65,13 @@ void TPPSMonitor::operator()() {
V += c->GetCarCount();
}
// kick on "no ping"
if (c->SecondsSinceLastPing() > (20 * 60)) {
beammp_debug("client " + std::string("(") + std::to_string(c->GetID()) + ")" + c->GetName() + " timing out: " + std::to_string(c->SecondsSinceLastPing()) + ", pps: " + Application::PPS());
if (c->SecondsSinceLastPing() > (20 * 60) ){
beammp_debugf("client {} ({}) timing out: {}", c->GetID(), c->GetName(), c->SecondsSinceLastPing());
TimedOutClients.push_back(c);
}
} else if (c->IsSynced() && c->SecondsSinceLastPing() > (1 * 60)) {
beammp_debugf("client {} ({}) timing out: {}", c->GetName(), c->GetID(), c->SecondsSinceLastPing());
TimedOutClients.push_back(c);
}
return true;
});