Break the decode loop if decoder raises an exception to give a chance to close the connection to a user handler
- Fixes: #1161
This commit is contained in:
parent
b186342f52
commit
e3d10ad493
@ -82,12 +82,12 @@ public abstract class ByteToMessageDecoder
|
||||
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
try {
|
||||
ByteBuf in = ctx.inboundByteBuffer();
|
||||
if (in.isReadable()) {
|
||||
callDecode(ctx, in);
|
||||
}
|
||||
|
||||
try {
|
||||
if (ctx.nextInboundMessageBuffer().unfoldAndAdd(decodeLast(ctx, in))) {
|
||||
ctx.fireInboundBufferUpdated();
|
||||
}
|
||||
@ -97,10 +97,10 @@ public abstract class ByteToMessageDecoder
|
||||
} else {
|
||||
ctx.fireExceptionCaught(new DecoderException(t));
|
||||
}
|
||||
}
|
||||
|
||||
} finally {
|
||||
ctx.fireChannelInactive();
|
||||
}
|
||||
}
|
||||
|
||||
protected void callDecode(ChannelHandlerContext ctx, ByteBuf in) {
|
||||
boolean wasNull = false;
|
||||
@ -144,6 +144,8 @@ public abstract class ByteToMessageDecoder
|
||||
} else {
|
||||
ctx.fireExceptionCaught(new DecoderException(t));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,13 +364,13 @@ public abstract class ReplayingDecoder<S> extends ByteToMessageDecoder {
|
||||
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
try {
|
||||
replayable.terminate();
|
||||
ByteBuf in = cumulation;
|
||||
if (in.isReadable()) {
|
||||
callDecode(ctx, in);
|
||||
}
|
||||
|
||||
try {
|
||||
if (ctx.nextInboundMessageBuffer().unfoldAndAdd(decodeLast(ctx, replayable))) {
|
||||
ctx.fireInboundBufferUpdated();
|
||||
}
|
||||
@ -383,10 +383,10 @@ public abstract class ReplayingDecoder<S> extends ByteToMessageDecoder {
|
||||
} else {
|
||||
ctx.fireExceptionCaught(new DecoderException(t));
|
||||
}
|
||||
}
|
||||
|
||||
} finally {
|
||||
ctx.fireChannelInactive();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void callDecode(ChannelHandlerContext ctx, ByteBuf buf) {
|
||||
@ -458,6 +458,8 @@ public abstract class ReplayingDecoder<S> extends ByteToMessageDecoder {
|
||||
} else {
|
||||
ctx.fireExceptionCaught(new DecoderException(t));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user