ResponseBuffers no longer assumes the initial position of the body byte buffer is zero
@@ -23,11 +23,13 @@ import java.io.Closeable;
class ResponseBuffers implements Closeable {
private final ReplyHeader replyHeader;
private final ByteBuf bodyByteBuffer;
+ private final int bodyByteBufferStartPosition;
private volatile boolean isClosed;
ResponseBuffers(final ReplyHeader replyHeader, final ByteBuf bodyByteBuffer) {
this.replyHeader = replyHeader;
this.bodyByteBuffer = bodyByteBuffer;
+ this.bodyByteBufferStartPosition = bodyByteBuffer == null ? 0 : bodyByteBuffer.position();
}
/**
@@ -50,7 +52,7 @@ class ResponseBuffers implements Closeable {
}
public void reset() {
- bodyByteBuffer.position(0);
+ bodyByteBuffer.position(bodyByteBufferStartPosition);
}
@Override
