mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2026-06-18 00:20:52 +00:00
attempt to fix mass timeout kick
This commit is contained in:
+1
-1
@@ -42,13 +42,13 @@ void TPPSMonitor::operator()() {
|
|||||||
}
|
}
|
||||||
// kick on "no ping"
|
// kick on "no ping"
|
||||||
if (c->SecondsSinceLastPing() > 10 && c->IsSynced() && !c->IsSyncing()) {
|
if (c->SecondsSinceLastPing() > 10 && c->IsSynced() && !c->IsSyncing()) {
|
||||||
|
debug("client " + std::string("(") + std::to_string(c->GetID()) + ")" + c->GetName() + " timing out: " + std::to_string(c->SecondsSinceLastPing()) + ", pps: " + Application::PPS());
|
||||||
TimedOutClients.push_back(c);
|
TimedOutClients.push_back(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
for (auto& ClientToKick : TimedOutClients) {
|
for (auto& ClientToKick : TimedOutClients) {
|
||||||
debug("client " + std::string("(") + std::to_string(ClientToKick->GetID()) + ")" + ClientToKick->GetName() + " kicked due to timeout!");
|
|
||||||
Network().ClientKick(*ClientToKick, "Timeout (no ping for >10 seconds)");
|
Network().ClientKick(*ClientToKick, "Timeout (no ping for >10 seconds)");
|
||||||
}
|
}
|
||||||
TimedOutClients.clear();
|
TimedOutClients.clear();
|
||||||
|
|||||||
+1
-2
@@ -76,8 +76,6 @@ void TServer::GlobalParser(const std::weak_ptr<TClient>& Client, std::string Pac
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto LockedClient = Client.lock();
|
auto LockedClient = Client.lock();
|
||||||
// FIXME: this should not be needed here
|
|
||||||
LockedClient->UpdatePingTime();
|
|
||||||
|
|
||||||
std::any Res;
|
std::any Res;
|
||||||
char Code = Packet.at(0);
|
char Code = Packet.at(0);
|
||||||
@@ -98,6 +96,7 @@ void TServer::GlobalParser(const std::weak_ptr<TClient>& Client, std::string Pac
|
|||||||
case 'p':
|
case 'p':
|
||||||
Network.Respond(*LockedClient, ("p"), false);
|
Network.Respond(*LockedClient, ("p"), false);
|
||||||
Network.UpdatePlayer(*LockedClient);
|
Network.UpdatePlayer(*LockedClient);
|
||||||
|
LockedClient->UpdatePingTime();
|
||||||
return;
|
return;
|
||||||
case 'O':
|
case 'O':
|
||||||
if (Packet.length() > 1000) {
|
if (Packet.length() > 1000) {
|
||||||
|
|||||||
Reference in New Issue
Block a user