You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a result, the player's latency is overestimated. For example, if you run a local minestom server, the latency will be about 50ms instead of the expected 0ms.
public static void listener(ClientKeepAlivePacket packet, Player player) {
final long packetId = packet.id();
if (packetId != player.getLastKeepAlive()) {
player.kick(KICK_MESSAGE);
return;
}
player.refreshAnswerKeepAlive(true);
// Update latency
final int latency = (int) (System.currentTimeMillis() - packetId);
player.refreshLatency(latency);
+ System.out.println(latency)
}
Result
Expected result: latency close to 0ms Actual result: latency close to 50ms
Potential solution
Potential solution: process the packet ClientKeepAlivePacket bypassing the player's packet queue (similar to packets with HANDSHAKE, STATUS and LOGIN states)
The text was updated successfully, but these errors were encountered:
Description
The Minestom server isn't processing
ClientKeepAlivePacket
correctly.This happens because all packets with
CONFIGURATION
andPLAY
states are added to the player's packet queue and processed in the minestom tick thread (see methodPacketProcessor#process(PlayerConnection, int, ByteBuffer)
).As a result, the player's latency is overestimated. For example, if you run a local minestom server, the latency will be about 50ms instead of the expected 0ms.
Report
The problem is relevant for the commit: e8e22a2
Steps to reproduce:
localhost
addressKeepAliveListener#listener(ClientKeepAlivePacket, Player)
public static void listener(ClientKeepAlivePacket packet, Player player) { final long packetId = packet.id(); if (packetId != player.getLastKeepAlive()) { player.kick(KICK_MESSAGE); return; } player.refreshAnswerKeepAlive(true); // Update latency final int latency = (int) (System.currentTimeMillis() - packetId); player.refreshLatency(latency); + System.out.println(latency) }
Result
Expected result: latency close to 0ms
Actual result: latency close to 50ms
Potential solution
Potential solution: process the packet
ClientKeepAlivePacket
bypassing the player's packet queue (similar to packets withHANDSHAKE
,STATUS
andLOGIN
states)The text was updated successfully, but these errors were encountered: