[#963] Fix invalid free-up of messages if they are only passed-throught in HttpContentEncoder and HttpContentDecoder

This commit is contained in:
Norman Maurer 2013-01-21 10:41:23 +01:00
parent 082b5f0dff
commit 29bed32a89
2 changed files with 23 additions and 0 deletions

View File

@ -114,6 +114,15 @@ public abstract class HttpContentDecoder extends MessageToMessageDecoder<Object>
return msg;
}
@Override
protected void freeInboundMessage(Object msg) throws Exception {
if (decoder == null) {
// if the decoder was null we returned the original message so we are not allowed to free it
return;
}
super.freeInboundMessage(msg);
}
private Object[] decodeContent(HttpMessage header, HttpContent c) {
ByteBuf newContent = Unpooled.buffer();
ByteBuf content = c.data();

View File

@ -161,6 +161,20 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpMessa
return null;
}
@Override
protected void freeOutboundMessage(Object msg) throws Exception {
if (encoder == null) {
// if the decoder was null we returned the original message so we are not allowed to free it
return;
}
super.freeOutboundMessage(msg);
}
@Override
protected void freeInboundMessage(HttpMessage msg) throws Exception {
// not free it as it is only passed through
}
private Object[] encodeContent(HttpMessage header, HttpContent c) {
ByteBuf newContent = Unpooled.buffer();
ByteBuf content = c.data();