-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClientKeepAlivePacket is processed incorrectly #2100
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: