"Incorrect Payload Received in KeepAlive packet for player"

The problem is that in my setup (described in the issue linked above)
the loohp-limbo server is receiving an unsolicited PacketInKeepAlive
message prior to sending any out.  This causes the payload validation
check to fail, resulting in the connection then being closed.

This commit changes the PacketInKeepAlive handler to ignore (other than
logging) unsolicited KeepAlive messages rather than act on them.

Possibly the logging is a bad idea unless it's limited to being
suppressed via a debug flag...
This commit is contained in:
Tad Hunt 2022-09-22 22:54:50 -06:00
parent c40a48b7ba
commit d29279285e
1 changed files with 4 additions and 1 deletions

View File

@ -613,8 +613,11 @@ public class ClientConnection extends Thread {
processMoveEvent.consume(event, to); processMoveEvent.consume(event, to);
} }
} else if (packetIn instanceof PacketPlayInKeepAlive) { } else if (packetIn instanceof PacketPlayInKeepAlive) {
long lastPayload = getLastKeepAlivePayLoad();
PacketPlayInKeepAlive alive = (PacketPlayInKeepAlive) packetIn; PacketPlayInKeepAlive alive = (PacketPlayInKeepAlive) packetIn;
if (alive.getPayload() != getLastKeepAlivePayLoad()) { if (lastPayload == -1) {
Limbo.getInstance().getConsole().sendMessage("Unsolicited KeepAlive packet for player " + player.getName() + " (payload " + String.valueOf(alive.getPayload()) + ")");
} else if (alive.getPayload() != lastPayload) {
Limbo.getInstance().getConsole().sendMessage("Incorrect Payload received in KeepAlive packet for player " + player.getName()); Limbo.getInstance().getConsole().sendMessage("Incorrect Payload received in KeepAlive packet for player " + player.getName());
break; break;
} }