From 40818513aa8b3eb48e27710fc02543d06989c3f3 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 10 May 2020 19:18:39 +0200 Subject: [PATCH] Fix packet length. --- .../gameserver/decoders/GameByteFrameDecoder.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java index 67778018..f902a3c6 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/decoders/GameByteFrameDecoder.java @@ -6,7 +6,13 @@ import io.netty.handler.codec.LengthFieldBasedFrameDecoder; public class GameByteFrameDecoder extends LengthFieldBasedFrameDecoder { - private static final int MAX_PACKET_LENGTH = 8192 * 16; + /** + * MAX_PACKET_LENGTH is based on the maximum camera PNG size. + * Source: https://superuser.com/a/759030 + * Maximum camera packet is 320 * 320 Pixel * 4 Bytes per Pixel = 409600. + * Adding some for overhead 409600 + 8192 = 417792 + */ + private static final int MAX_PACKET_LENGTH = 417792; private static final int LENGTH_FIELD_OFFSET = 0; private static final int LENGTH_FIELD_LENGTH = 4; private static final int LENGTH_FIELD_ADJUSTMENT = 0;