[#1630] Fix re-entrance bug in ChannelOutboundBuffer.remove(...)

This commit is contained in:
Norman Maurer 2013-07-22 10:44:33 +02:00
parent 125070958d
commit 0f6cc0cc7b

View File

@ -342,10 +342,13 @@ public final class ChannelOutboundBuffer {
promise.trySuccess(); promise.trySuccess();
flushedPromises[head] = null; flushedPromises[head] = null;
decrementPendingOutboundBytes(flushedPendingSizes[head]); int size = flushedPendingSizes[head];
flushedPendingSizes[head] = 0; flushedPendingSizes[head] = 0;
this.head = head + 1 & flushed.length - 1; this.head = head + 1 & flushed.length - 1;
decrementPendingOutboundBytes(size);
return true; return true;
} }
@ -363,10 +366,12 @@ public final class ChannelOutboundBuffer {
safeFail(flushedPromises[head], cause); safeFail(flushedPromises[head], cause);
flushedPromises[head] = null; flushedPromises[head] = null;
decrementPendingOutboundBytes(flushedPendingSizes[head]); int size = flushedPendingSizes[head];
flushedPendingSizes[head] = 0; flushedPendingSizes[head] = 0;
this.head = head + 1 & flushed.length - 1; this.head = head + 1 & flushed.length - 1;
decrementPendingOutboundBytes(size);
return true; return true;
} }