[#1619] Fix bug in ChannelOutboundBuffer which could lead to invalid write order when fireChannelWritabilityChanged() write another message

This commit is contained in:
Norman Maurer 2013-07-20 10:03:53 +02:00
parent 80f92f90cb
commit 7f86550ef8

View File

@ -151,13 +151,15 @@ public final class ChannelOutboundBuffer {
}
final int size = channel.calculateMessageSize(msg);
incrementPendingOutboundBytes(size);
unflushed[unflushedCount] = msg;
unflushedPendingSizes[unflushedCount] = size;
unflushedPromises[unflushedCount] = promise;
unflushedTotals[unflushedCount] = total(msg);
this.unflushedCount = unflushedCount + 1;
// increment pending bytes after adding message to the unflushed arrays.
// See https://github.com/netty/netty/issues/1619
incrementPendingOutboundBytes(size);
}
private static long total(Object msg) {