Fixed an infinite loop
This commit is contained in:
parent
4ef4a92281
commit
3412003bc2
@ -172,10 +172,14 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
|
|||||||
ChunkedInput chunks = (ChunkedInput) m;
|
ChunkedInput chunks = (ChunkedInput) m;
|
||||||
Object chunk;
|
Object chunk;
|
||||||
boolean endOfInput;
|
boolean endOfInput;
|
||||||
|
boolean later;
|
||||||
try {
|
try {
|
||||||
chunk = chunks.nextChunk();
|
chunk = chunks.nextChunk();
|
||||||
if (chunk == null) {
|
if (chunk == null) {
|
||||||
chunk = ChannelBuffers.EMPTY_BUFFER;
|
chunk = ChannelBuffers.EMPTY_BUFFER;
|
||||||
|
later = true;
|
||||||
|
} else {
|
||||||
|
later = false;
|
||||||
}
|
}
|
||||||
endOfInput = chunks.isEndOfInput();
|
endOfInput = chunks.isEndOfInput();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
@ -211,6 +215,12 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
|
|||||||
Channels.write(
|
Channels.write(
|
||||||
ctx, writeFuture, chunk,
|
ctx, writeFuture, chunk,
|
||||||
currentEvent.getRemoteAddress());
|
currentEvent.getRemoteAddress());
|
||||||
|
|
||||||
|
if (later) {
|
||||||
|
// ChunkedInput.nextChunk() returned null.
|
||||||
|
// Let's wait until more chunks arrive.
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ctx.sendDownstream(currentEvent);
|
ctx.sendDownstream(currentEvent);
|
||||||
currentEvent = null;
|
currentEvent = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user