diff --git a/src/server/Session.php b/src/server/Session.php index fee1e92..24d3546 100644 --- a/src/server/Session.php +++ b/src/server/Session.php @@ -263,8 +263,13 @@ private function handleEncapsulatedPacketRoute(EncapsulatedPacket $packet) : voi * @param int $sendPongTime TODO: clock differential stuff */ private function handlePong(int $sendPingTime, int $sendPongTime) : void{ - $this->lastPingMeasure = $this->server->getRakNetTimeMS() - $sendPingTime; - $this->server->getEventListener()->onPingMeasure($this->internalId, $this->lastPingMeasure); + $currentTime = $this->server->getRakNetTimeMS(); + if($currentTime < $sendPingTime){ + $this->logger->debug("Received invalid pong: timestamp is in the future by " . ($sendPingTime - $currentTime) . " ms"); + }else{ + $this->lastPingMeasure = $currentTime - $sendPingTime; + $this->server->getEventListener()->onPingMeasure($this->internalId, $this->lastPingMeasure); + } } public function handlePacket(Packet $packet) : void{