|
|
@ -119,9 +119,10 @@ public class PacketDecoder { |
|
|
|
public Packet decodePackets(ByteBuf buffer, ClientHead client) throws IOException { |
|
|
|
if (isStringPacket(buffer)) { |
|
|
|
// TODO refactor |
|
|
|
int headEndIndex = buffer.bytesBefore(10, (byte)-1); |
|
|
|
int maxLength = Math.min(buffer.readableBytes(), 10); |
|
|
|
int headEndIndex = buffer.bytesBefore(maxLength, (byte)-1); |
|
|
|
if (headEndIndex == -1) { |
|
|
|
headEndIndex = buffer.bytesBefore(10, (byte)0x3f); |
|
|
|
headEndIndex = buffer.bytesBefore(maxLength, (byte)0x3f); |
|
|
|
} |
|
|
|
int len = (int) readLong(buffer, headEndIndex); |
|
|
|
|
|
|
|