Skip to content

Commit

Permalink
Fix a bug in ChannelOutboundBuffer.forEachFlushedMessage()
Browse files Browse the repository at this point in the history
Motivation:

ChannelOutboundBuffer.forEachFlushedMessage() visits even an unflushed
messages.

Modifications:

Stop the loop if the currently visiting entry is unflushedEntry.

Result:

forEachFlushedMessage() behaves correctly.
  • Loading branch information
trustin committed Jul 30, 2014
1 parent 5e5d1a5 commit 8ee3575
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -573,15 +573,20 @@ public void forEachFlushedMessage(MessageProcessor processor) throws Exception {
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 {
Expand Down

0 comments on commit 8ee3575

Please sign in to comment.