mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-03 08:15:35 +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() {
|
void TClient::UpdatePingTime() {
|
||||||
mLastPingTime = std::chrono::high_resolution_clock::now();
|
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() {
|
int TClient::SecondsSinceLastPing() {
|
||||||
auto seconds = std::chrono::duration_cast<std::chrono::seconds>(
|
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()));
|
//debug("Parsing from " + c->GetName() + " -> " +std::to_string(Ret.size()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
c.UpdatePingTime();
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,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