Proper assertion instead of blindly clearing the OutputMessageBuf
This commit is contained in:
parent
7ee2adb587
commit
8a672c2800
@ -107,9 +107,6 @@ public abstract class ByteToMessageDecoder
|
||||
protected void callDecode(ChannelHandlerContext ctx, ByteBuf in) {
|
||||
boolean wasNull = false;
|
||||
OutputMessageBuf out = OutputMessageBuf.get();
|
||||
|
||||
assert out.isEmpty();
|
||||
|
||||
try {
|
||||
while (in.isReadable()) {
|
||||
try {
|
||||
|
@ -48,7 +48,6 @@ public abstract class MessageToMessageEncoder<I> extends ChannelOutboundMessageH
|
||||
@Override
|
||||
public final void flush(ChannelHandlerContext ctx, I msg) throws Exception {
|
||||
OutputMessageBuf out = OutputMessageBuf.get();
|
||||
|
||||
try {
|
||||
encode(ctx, msg, out);
|
||||
} catch (CodecException e) {
|
||||
|
@ -35,8 +35,7 @@ final class OutputMessageBuf extends DefaultMessageBuf<Object> {
|
||||
@Override
|
||||
public OutputMessageBuf get() {
|
||||
OutputMessageBuf buf = super.get();
|
||||
// Just to be sure
|
||||
buf.clear();
|
||||
assert buf.isEmpty();
|
||||
return buf;
|
||||
}
|
||||
};
|
||||
@ -46,6 +45,7 @@ final class OutputMessageBuf extends DefaultMessageBuf<Object> {
|
||||
}
|
||||
|
||||
private OutputMessageBuf() {
|
||||
super(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -364,7 +364,6 @@ public abstract class ReplayingDecoder<S> extends ByteToMessageDecoder {
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
OutputMessageBuf out = OutputMessageBuf.get();
|
||||
|
||||
try {
|
||||
replayable.terminate();
|
||||
ByteBuf in = cumulation;
|
||||
@ -396,8 +395,6 @@ public abstract class ReplayingDecoder<S> extends ByteToMessageDecoder {
|
||||
boolean wasNull = false;
|
||||
ByteBuf in = cumulation;
|
||||
OutputMessageBuf out = OutputMessageBuf.get();
|
||||
assert out.isEmpty();
|
||||
|
||||
try {
|
||||
while (in.isReadable()) {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user