Fix release of buffers in ByteToMessageCodec and MessageToMessageCodec

This commit is contained in:
Norman Maurer 2012-12-08 12:59:32 +01:00
parent 312810d415
commit bf8345999c
2 changed files with 13 additions and 2 deletions

View File

@ -16,6 +16,7 @@
package io.netty.handler.codec;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ChannelBuf;
import io.netty.buffer.MessageBuf;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerAdapter;
@ -69,6 +70,16 @@ public abstract class ByteToMessageCodec<INBOUND_OUT, OUTBOUND_IN>
encoder.flush(ctx, future);
}
@Override
public void freeInboundBuffer(ChannelHandlerContext ctx, ChannelBuf buf) throws Exception {
decoder.freeInboundBuffer(ctx, buf);
}
@Override
public void freeOutboundBuffer(ChannelHandlerContext ctx, ChannelBuf buf) throws Exception {
encoder.freeOutboundBuffer(ctx, buf);
}
public abstract void encode(
ChannelHandlerContext ctx,
OUTBOUND_IN msg, ByteBuf out) throws Exception;

View File

@ -75,7 +75,7 @@ public abstract class MessageToMessageCodec<INBOUND_IN, INBOUND_OUT, OUTBOUND_IN
@Override
public void freeInboundBuffer(ChannelHandlerContext ctx, ChannelBuf buf) throws Exception {
// Nothing to free
buf.unsafe().free();
}
@Override
@ -91,7 +91,7 @@ public abstract class MessageToMessageCodec<INBOUND_IN, INBOUND_OUT, OUTBOUND_IN
@Override
public void freeOutboundBuffer(ChannelHandlerContext ctx, ChannelBuf buf) throws Exception {
// Nothing to free
buf.unsafe().free();
}
@Override