mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-04 00:36:14 +00:00
update ping time on any packet, not just ping packets, for now
This commit is contained in:
parent
61726ea3ab
commit
1875c8832d
@ -37,12 +37,13 @@ void TPPSMonitor::operator()() {
|
|||||||
C++;
|
C++;
|
||||||
V += c->GetCarCount();
|
V += c->GetCarCount();
|
||||||
}
|
}
|
||||||
// kick on "no ping"
|
if (!c->IsSynced() || c->IsSyncing()) {
|
||||||
if (c->SecondsSinceLastPing() > 10 && c->IsSynced()) {
|
|
||||||
TimedOutClients.push_back(c);
|
|
||||||
} else if (!c->IsSynced()) {
|
|
||||||
c->UpdatePingTime();
|
c->UpdatePingTime();
|
||||||
}
|
}
|
||||||
|
// kick on "no ping"
|
||||||
|
if (c->SecondsSinceLastPing() > 10 && c->IsSynced() && !c->IsSyncing()) {
|
||||||
|
TimedOutClients.push_back(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -76,6 +76,8 @@ 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);
|
||||||
@ -96,7 +98,6 @@ 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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user