GroupedPacketHandler cleanup

This commit is contained in:
themode 2020-12-15 09:55:53 +01:00
parent b9a0a761c4
commit b808497c9b

View File

@ -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);
}
}