mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-04 00:36:14 +00:00
add name to debug print, update ping time each packet
This commit is contained in:
parent
b524aa67de
commit
667bd7f7c8
@ -81,7 +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"));
|
||||
debug(GetName() + ": " + std::string("ping time updated!: ") + ((SecondsSinceLastPing() == 0) ? "OK" : "ERR"));
|
||||
}
|
||||
int TClient::SecondsSinceLastPing() {
|
||||
auto seconds = std::chrono::duration_cast<std::chrono::seconds>(
|
||||
|
@ -467,6 +467,8 @@ std::string TNetwork::TCPRcv(TClient& c) {
|
||||
//debug("Parsing from " + c->GetName() + " -> " +std::to_string(Ret.size()));
|
||||
#endif
|
||||
|
||||
c.UpdatePingTime();
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,6 @@ void TServer::GlobalParser(const std::weak_ptr<TClient>& Client, std::string Pac
|
||||
case 'p':
|
||||
Network.Respond(*LockedClient, ("p"), false);
|
||||
Network.UpdatePlayer(*LockedClient);
|
||||
LockedClient->UpdatePingTime();
|
||||
return;
|
||||
case 'O':
|
||||
if (Packet.length() > 1000) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user