From 17e37fdfe6ccd397cee3e41e12975a527f722f6b Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Tue, 12 Feb 2013 20:34:59 +0100 Subject: [PATCH] [#1047] Not process with flush on failure --- .../channel/ChannelOutboundMessageHandlerAdapter.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/transport/src/main/java/io/netty/channel/ChannelOutboundMessageHandlerAdapter.java b/transport/src/main/java/io/netty/channel/ChannelOutboundMessageHandlerAdapter.java index f6c9e25c2a..8a8e73a4a9 100644 --- a/transport/src/main/java/io/netty/channel/ChannelOutboundMessageHandlerAdapter.java +++ b/transport/src/main/java/io/netty/channel/ChannelOutboundMessageHandlerAdapter.java @@ -80,6 +80,7 @@ public abstract class ChannelOutboundMessageHandlerAdapter public final void flush(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception { MessageBuf in = ctx.outboundMessageBuffer(); MessageBuf out = null; + boolean failure = false; final int inSize = in.size(); if (inSize == 0) { @@ -124,7 +125,9 @@ public abstract class ChannelOutboundMessageHandlerAdapter } else { pfe = new PartialFlushException(msg, t); } + t.printStackTrace(); fail(ctx, promise, pfe); + failure = true; } try { @@ -136,10 +139,11 @@ public abstract class ChannelOutboundMessageHandlerAdapter } 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) {