mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-01 23:46:59 +00:00
send ping only when updated
This commit is contained in:
parent
3f1a2a281b
commit
f93536758f
@ -69,10 +69,12 @@ void Server::ServerParser(const std::string& Data) {
|
||||
case 'p':
|
||||
PingEnd = std::chrono::high_resolution_clock::now();
|
||||
if (PingStart > PingEnd) Ping = 0;
|
||||
else
|
||||
Ping = int(std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
PingEnd - PingStart)
|
||||
.count());
|
||||
else {
|
||||
Ping = int(std::chrono::duration_cast<std::chrono::milliseconds>(PingEnd - PingStart).count());
|
||||
if (Ping > 800) {
|
||||
LauncherInstance->SendIPC("Up-2");
|
||||
} else LauncherInstance->SendIPC("Up" + std::to_string(Ping));
|
||||
}
|
||||
return;
|
||||
case 'M':
|
||||
MStatus = Data;
|
||||
@ -86,7 +88,4 @@ void Server::ServerParser(const std::string& Data) {
|
||||
break;
|
||||
}
|
||||
LauncherInstance->SendIPC(Data, false);
|
||||
if (getPing() > 800) {
|
||||
LauncherInstance->SendIPC("Up-2");
|
||||
} else LauncherInstance->SendIPC("Up" + std::to_string(getPing()));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user