Make sure channelInactive() and channelDeregistered() are triggered even if outboundBuffer.recycle() fails

This commit is contained in:
Trustin Lee 2013-07-19 01:09:19 +09:00
parent 7215c011ca
commit fef838f197

View File

@ -523,11 +523,13 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
}
// fail all queued messages
try {
ChannelOutboundBuffer outboundBuffer = this.outboundBuffer;
outboundBuffer.failFlushed(CLOSED_CHANNEL_EXCEPTION);
outboundBuffer.failUnflushed(CLOSED_CHANNEL_EXCEPTION);
outboundBuffer.recycle();
this.outboundBuffer = null;
} finally {
outboundBuffer = null;
if (wasActive && !isActive()) {
invokeLater(new Runnable() {
@ -539,6 +541,7 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
}
deregister(voidPromise());
}
} else {
// Closed already.
promise.setSuccess();