Make sure WebSocketFrameAggregator and HttpObjectAggregator don't leak ByteBufs
This commit is contained in:
parent
16e12b45f8
commit
e3ec124ccd
@ -210,8 +210,30 @@ public class HttpObjectAggregator extends MessageToMessageDecoder<HttpObject> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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
|
||||||
|
if (currentMessage != null) {
|
||||||
|
currentMessage.release();
|
||||||
|
currentMessage = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
|
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
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
|
||||||
|
// this case
|
||||||
|
if (currentMessage != null) {
|
||||||
|
currentMessage.release();
|
||||||
|
currentMessage = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,4 +97,26 @@ public class WebSocketFrameAggregator extends MessageToMessageDecoder<WebSocketF
|
|||||||
// handler in the chain
|
// handler in the chain
|
||||||
out.add(msg.retain());
|
out.add(msg.retain());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
super.channelInactive(ctx);
|
||||||
|
|
||||||
|
// release current frame if it is not null as it may be a left-over
|
||||||
|
if (currentFrame != null) {
|
||||||
|
currentFrame.release();
|
||||||
|
currentFrame = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
super.handlerRemoved(ctx);
|
||||||
|
// release current frane if it is not null as it may be a left-over as there is not much more we can do in
|
||||||
|
// this case
|
||||||
|
if (currentFrame != null) {
|
||||||
|
currentFrame.release();
|
||||||
|
currentFrame = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user