Fix release of buffers in ByteToMessageCodec and MessageToMessageCodec
This commit is contained in:
parent
312810d415
commit
bf8345999c
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user