Fix a bug in ChannelOutboundBuffer.forEachFlushedMessage()

Motivation:

ChannelOutboundBuffer.forEachFlushedMessage() visits even an unflushed
messages.

Modifications:

Stop the loop if the currently visiting entry is unflushedEntry.

Result:

forEachFlushedMessage() behaves correctly.
This commit is contained in:
Trustin Lee 2014-07-30 15:36:33 -07:00
parent 5e5d1a58fd
commit 8ee3575e72

View File

@ -573,15 +573,20 @@ public final class ChannelOutboundBuffer {
if (processor == null) {
throw new NullPointerException("processor");
}
Entry entry = flushedEntry;
while (entry != null) {
if (entry == null) {
return;
}
do {
if (!entry.cancelled) {
if (!processor.processMessage(entry.msg)) {
return;
}
}
entry = entry.next;
}
} while (entry != null && entry != unflushedEntry);
}
public interface MessageProcessor {