Skip to content

Commit

Permalink
RATIS-2189. Use ByteBufAllocator#ioBuffer in NettyDataStreamUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
ivandika3 committed Nov 15, 2024
1 parent e75a0d5 commit a48f4c1
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ static void encodeDataStreamRequestHeader(DataStreamRequest request, Consumer<Ob
ByteBufAllocator allocator) {
final ByteBuffer headerBuf = getDataStreamRequestHeaderProtoByteBuffer(request);

final ByteBuf headerBodyLenBuf = allocator.directBuffer(DataStreamPacketHeader.getSizeOfHeaderBodyLen());
final ByteBuf headerBodyLenBuf = allocator.ioBuffer(DataStreamPacketHeader.getSizeOfHeaderBodyLen());
headerBodyLenBuf.writeLong(headerBuf.remaining() + request.getDataLength());
out.accept(headerBodyLenBuf);

final ByteBuf headerLenBuf = allocator.directBuffer(DataStreamPacketHeader.getSizeOfHeaderLen());
final ByteBuf headerLenBuf = allocator.ioBuffer(DataStreamPacketHeader.getSizeOfHeaderLen());
headerLenBuf.writeInt(headerBuf.remaining());
out.accept(headerLenBuf);

Expand Down Expand Up @@ -152,7 +152,7 @@ static void encodeDataStreamRequestFilePositionCount(
static void encodeDataStreamReplyByteBuffer(DataStreamReplyByteBuffer reply, Consumer<ByteBuf> out,
ByteBufAllocator allocator) {
ByteBuffer headerBuf = getDataStreamReplyHeaderProtoByteBuf(reply);
final ByteBuf headerLenBuf = allocator.directBuffer(DataStreamPacketHeader.getSizeOfHeaderLen());
final ByteBuf headerLenBuf = allocator.ioBuffer(DataStreamPacketHeader.getSizeOfHeaderLen());
headerLenBuf.writeInt(headerBuf.remaining());
out.accept(headerLenBuf);
out.accept(Unpooled.wrappedBuffer(headerBuf));
Expand Down

0 comments on commit a48f4c1

Please sign in to comment.