[#1047] Not process with flush on failure

This commit is contained in:
Norman Maurer 2013-02-12 20:34:59 +01:00
parent fcba55329c
commit 17e37fdfe6

View File

@ -80,6 +80,7 @@ public abstract class ChannelOutboundMessageHandlerAdapter<I>
public final void flush(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception {
MessageBuf<Object> in = ctx.outboundMessageBuffer();
MessageBuf<Object> out = null;
boolean failure = false;
final int inSize = in.size();
if (inSize == 0) {
@ -124,7 +125,9 @@ public abstract class ChannelOutboundMessageHandlerAdapter<I>
} else {
pfe = new PartialFlushException(msg, t);
}
t.printStackTrace();
fail(ctx, promise, pfe);
failure = true;
}
try {
@ -136,10 +139,11 @@ public abstract class ChannelOutboundMessageHandlerAdapter<I>
} else {
fail(ctx, promise, t);
}
return;
failure = true;
}
if (!failure) {
ctx.flush(promise);
}
ctx.flush(promise);
}
private void fail(ChannelHandlerContext ctx, ChannelPromise promise, Throwable cause) {