File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -263,8 +263,13 @@ private function handleEncapsulatedPacketRoute(EncapsulatedPacket $packet) : voi
263
263
* @param int $sendPongTime TODO: clock differential stuff
264
264
*/
265
265
private function handlePong (int $ sendPingTime , int $ sendPongTime ) : void {
266
- $ this ->lastPingMeasure = $ this ->server ->getRakNetTimeMS () - $ sendPingTime ;
267
- $ this ->server ->getEventListener ()->onPingMeasure ($ this ->internalId , $ this ->lastPingMeasure );
266
+ $ currentTime = $ this ->server ->getRakNetTimeMS ();
267
+ if ($ currentTime < $ sendPingTime ){
268
+ $ this ->logger ->debug ("Received invalid pong: timestamp is in the future by " . ($ sendPingTime - $ currentTime ) . " ms " );
269
+ }else {
270
+ $ this ->lastPingMeasure = $ currentTime - $ sendPingTime ;
271
+ $ this ->server ->getEventListener ()->onPingMeasure ($ this ->internalId , $ this ->lastPingMeasure );
272
+ }
268
273
}
269
274
270
275
public function handlePacket (Packet $ packet ) : void {
You can’t perform that action at this time.
0 commit comments