geforkt von Mirrors/Velocity
Try to decode multiple packets at once
Dieser Commit ist enthalten in:
Ursprung
d333eb30b8
Commit
ba8629ca0e
@ -11,10 +11,7 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder {
|
||||
|
||||
@Override
|
||||
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
|
||||
if (!in.isReadable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
read_lens: while (in.isReadable()) {
|
||||
int origReaderIndex = in.readerIndex();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (!in.isReadable()) {
|
||||
@ -30,14 +27,15 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder {
|
||||
|
||||
if (in.readableBytes() >= packetLength) {
|
||||
out.add(in.readRetainedSlice(packetLength));
|
||||
continue read_lens;
|
||||
} else {
|
||||
in.readerIndex(origReaderIndex);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new CorruptedFrameException("VarInt too big");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren