mirror of
https://github.com/Minestom/Minestom.git
synced 2024-10-01 07:57:41 +02:00
GroupedPacketHandler cleanup
This commit is contained in:
parent
b9a0a761c4
commit
b808497c9b
@ -17,10 +17,11 @@ public class GroupedPacketHandler extends MessageToByteEncoder<FramedPacket> {
|
||||
|
||||
@Override
|
||||
protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, FramedPacket msg, boolean preferDirect) {
|
||||
final int size = msg.body.writerIndex();
|
||||
if (preferDirect) {
|
||||
return ctx.alloc().directBuffer(msg.body.writerIndex());
|
||||
return ctx.alloc().directBuffer(size, size);
|
||||
} else {
|
||||
return ctx.alloc().heapBuffer(msg.body.writerIndex());
|
||||
return ctx.alloc().heapBuffer(size, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user