Fix a bug in ChannelOutboundBuffer.nioBuffers()
Related issue: #2717, #2710, #2704, #2693 Motivation: When ChannelOutboundBuffer.nioBuffers() iterates over the linked list of entries, it is not supposed to visit unflushed entries, but it does. Modifications: - Make sure ChannelOutboundBuffer.nioBuffers() stops the iteration before it visits an unflushed entry - Add isFlushedEntry() to reduce the chance of the similar mistakes Result: Another regression is gone.
This commit is contained in:
parent
8ee3575e72
commit
d6f0d12a86
@ -356,7 +356,7 @@ public final class ChannelOutboundBuffer {
|
||||
final InternalThreadLocalMap threadLocalMap = InternalThreadLocalMap.get();
|
||||
ByteBuffer[] nioBuffers = NIO_BUFFERS.get(threadLocalMap);
|
||||
Entry entry = flushedEntry;
|
||||
while (entry != null && entry.msg instanceof ByteBuf) {
|
||||
while (isFlushedEntry(entry) && entry.msg instanceof ByteBuf) {
|
||||
if (!entry.cancelled) {
|
||||
ByteBuf buf = (ByteBuf) entry.msg;
|
||||
final int readerIndex = buf.readerIndex();
|
||||
@ -586,7 +586,11 @@ public final class ChannelOutboundBuffer {
|
||||
}
|
||||
}
|
||||
entry = entry.next;
|
||||
} while (entry != null && entry != unflushedEntry);
|
||||
} while (isFlushedEntry(entry));
|
||||
}
|
||||
|
||||
private boolean isFlushedEntry(Entry e) {
|
||||
return e != null && e != unflushedEntry;
|
||||
}
|
||||
|
||||
public interface MessageProcessor {
|
||||
|
Loading…
x
Reference in New Issue
Block a user