Do not write an empty buffer unnecessarily when nextChunk() returned

null
This commit is contained in:
Trustin Lee 2011-03-03 01:32:27 +09:00
parent a5e9f633ef
commit 98b2b6d8dc

View File

@ -226,6 +226,12 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
break;
}
if (suspend) {
// ChunkedInput.nextChunk() returned null and it has
// not reached at the end of input. Let's wait until
// more chunks arrive. Nothing to write or notify.
break;
} else {
ChannelFuture writeFuture;
if (endOfInput) {
this.currentEvent = null;
@ -248,12 +254,6 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
Channels.write(
ctx, writeFuture, chunk,
currentEvent.getRemoteAddress());
if (suspend) {
// ChunkedInput.nextChunk() returned null and it has
// not reached at the end of input. Let's wait until
// more chunks arrive.
break;
}
} else {
this.currentEvent = null;