Make ReplayingDecoder.newInboundBuffer/discardInboundReadByte() final for safety
This commit is contained in:
parent
82c46180c9
commit
01e65a01c7
@ -342,22 +342,29 @@ public abstract class ReplayingDecoder<S> extends ByteToMessageDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ByteBuf newInboundBuffer(
|
public final ByteBuf newInboundBuffer(ChannelHandlerContext ctx) throws Exception {
|
||||||
ChannelHandlerContext ctx) throws Exception {
|
cumulation = newInboundBuffer0(ctx);
|
||||||
cumulation = ctx.alloc().buffer();
|
|
||||||
replayable = new ReplayingDecoderBuffer(cumulation);
|
replayable = new ReplayingDecoderBuffer(cumulation);
|
||||||
return cumulation;
|
return cumulation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected ByteBuf newInboundBuffer0(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
return super.newInboundBuffer(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void discardInboundReadBytes(ChannelHandlerContext ctx) throws Exception {
|
public final void discardInboundReadBytes(ChannelHandlerContext ctx) throws Exception {
|
||||||
ByteBuf in = ctx.inboundByteBuffer();
|
ByteBuf in = ctx.inboundByteBuffer();
|
||||||
final int oldReaderIndex = in.readerIndex();
|
final int oldReaderIndex = in.readerIndex();
|
||||||
super.discardInboundReadBytes(ctx);
|
discardInboundReadBytes0(ctx);
|
||||||
final int newReaderIndex = in.readerIndex();
|
final int newReaderIndex = in.readerIndex();
|
||||||
checkpoint -= oldReaderIndex - newReaderIndex;
|
checkpoint -= oldReaderIndex - newReaderIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void discardInboundReadBytes0(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
super.discardInboundReadBytes(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
replayable.terminate();
|
replayable.terminate();
|
||||||
|
Loading…
Reference in New Issue
Block a user