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
|
||||
public ByteBuf newInboundBuffer(
|
||||
ChannelHandlerContext ctx) throws Exception {
|
||||
cumulation = ctx.alloc().buffer();
|
||||
public final ByteBuf newInboundBuffer(ChannelHandlerContext ctx) throws Exception {
|
||||
cumulation = newInboundBuffer0(ctx);
|
||||
replayable = new ReplayingDecoderBuffer(cumulation);
|
||||
return cumulation;
|
||||
}
|
||||
|
||||
protected ByteBuf newInboundBuffer0(ChannelHandlerContext ctx) throws Exception {
|
||||
return super.newInboundBuffer(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void discardInboundReadBytes(ChannelHandlerContext ctx) throws Exception {
|
||||
public final void discardInboundReadBytes(ChannelHandlerContext ctx) throws Exception {
|
||||
ByteBuf in = ctx.inboundByteBuffer();
|
||||
final int oldReaderIndex = in.readerIndex();
|
||||
super.discardInboundReadBytes(ctx);
|
||||
discardInboundReadBytes0(ctx);
|
||||
final int newReaderIndex = in.readerIndex();
|
||||
checkpoint -= oldReaderIndex - newReaderIndex;
|
||||
}
|
||||
|
||||
protected void discardInboundReadBytes0(ChannelHandlerContext ctx) throws Exception {
|
||||
super.discardInboundReadBytes(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
replayable.terminate();
|
||||
|
Loading…
Reference in New Issue
Block a user