Clean up HttpObjectAggregator
This commit is contained in:
parent
b4e3e09b76
commit
8738bc4ae7
@ -136,8 +136,8 @@ public class HttpObjectAggregator extends MessageToMessageDecoder<HttpObject> {
|
|||||||
|
|
||||||
if (!m.getDecoderResult().isSuccess()) {
|
if (!m.getDecoderResult().isSuccess()) {
|
||||||
removeTransferEncodingChunked(m);
|
removeTransferEncodingChunked(m);
|
||||||
this.currentMessage = null;
|
|
||||||
out.add(ReferenceCountUtil.retain(m));
|
out.add(ReferenceCountUtil.retain(m));
|
||||||
|
this.currentMessage = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (msg instanceof HttpRequest) {
|
if (msg instanceof HttpRequest) {
|
||||||
@ -178,9 +178,7 @@ public class HttpObjectAggregator extends MessageToMessageDecoder<HttpObject> {
|
|||||||
currentMessage.release();
|
currentMessage.release();
|
||||||
this.currentMessage = null;
|
this.currentMessage = null;
|
||||||
|
|
||||||
throw new TooLongFrameException(
|
throw new TooLongFrameException("HTTP content length exceeded " + maxContentLength + " bytes.");
|
||||||
"HTTP content length exceeded " + maxContentLength +
|
|
||||||
" bytes.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append the content of the chunk
|
// Append the content of the chunk
|
||||||
@ -200,8 +198,6 @@ public class HttpObjectAggregator extends MessageToMessageDecoder<HttpObject> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (last) {
|
if (last) {
|
||||||
this.currentMessage = null;
|
|
||||||
|
|
||||||
// Merge trailing headers into the message.
|
// Merge trailing headers into the message.
|
||||||
if (chunk instanceof LastHttpContent) {
|
if (chunk instanceof LastHttpContent) {
|
||||||
LastHttpContent trailer = (LastHttpContent) chunk;
|
LastHttpContent trailer = (LastHttpContent) chunk;
|
||||||
@ -215,6 +211,7 @@ public class HttpObjectAggregator extends MessageToMessageDecoder<HttpObject> {
|
|||||||
|
|
||||||
// All done
|
// All done
|
||||||
out.add(currentMessage);
|
out.add(currentMessage);
|
||||||
|
this.currentMessage = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error();
|
throw new Error();
|
||||||
@ -223,13 +220,13 @@ public class HttpObjectAggregator extends MessageToMessageDecoder<HttpObject> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
super.channelInactive(ctx);
|
|
||||||
|
|
||||||
// release current message if it is not null as it may be a left-over
|
// release current message if it is not null as it may be a left-over
|
||||||
if (currentMessage != null) {
|
if (currentMessage != null) {
|
||||||
currentMessage.release();
|
currentMessage.release();
|
||||||
currentMessage = null;
|
currentMessage = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super.channelInactive(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -240,6 +237,7 @@ public class HttpObjectAggregator extends MessageToMessageDecoder<HttpObject> {
|
|||||||
@Override
|
@Override
|
||||||
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
|
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
|
||||||
super.handlerRemoved(ctx);
|
super.handlerRemoved(ctx);
|
||||||
|
|
||||||
// release current message if it is not null as it may be a left-over as there is not much more we can do in
|
// release current message if it is not null as it may be a left-over as there is not much more we can do in
|
||||||
// this case
|
// this case
|
||||||
if (currentMessage != null) {
|
if (currentMessage != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user