Fix StackOverflowError in ChunkedWriteHandler; issue #620
This commit is contained in:
parent
a7d205075b
commit
5362842548
@ -186,6 +186,7 @@ public class ChunkedWriteHandler
|
|||||||
private void flush(ChannelHandlerContext ctx, boolean fireNow) throws Exception {
|
private void flush(ChannelHandlerContext ctx, boolean fireNow) throws Exception {
|
||||||
boolean acquired = false;
|
boolean acquired = false;
|
||||||
final Channel channel = ctx.getChannel();
|
final Channel channel = ctx.getChannel();
|
||||||
|
boolean suspend = false;
|
||||||
|
|
||||||
// use CAS to see if the have flush already running, if so we don't need to take futher actions
|
// use CAS to see if the have flush already running, if so we don't need to take futher actions
|
||||||
if (acquired = flush.compareAndSet(false, true)) {
|
if (acquired = flush.compareAndSet(false, true)) {
|
||||||
@ -216,7 +217,6 @@ public class ChunkedWriteHandler
|
|||||||
final ChunkedInput chunks = (ChunkedInput) m;
|
final ChunkedInput chunks = (ChunkedInput) m;
|
||||||
Object chunk;
|
Object chunk;
|
||||||
boolean endOfInput;
|
boolean endOfInput;
|
||||||
boolean suspend;
|
|
||||||
try {
|
try {
|
||||||
chunk = chunks.nextChunk();
|
chunk = chunks.nextChunk();
|
||||||
endOfInput = chunks.isEndOfInput();
|
endOfInput = chunks.isEndOfInput();
|
||||||
@ -297,7 +297,7 @@ public class ChunkedWriteHandler
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (acquired && (!channel.isConnected() || channel.isWritable() && !queue.isEmpty())) {
|
if (acquired && (!channel.isConnected() || channel.isWritable() && !queue.isEmpty() && !suspend)) {
|
||||||
flush(ctx, fireNow);
|
flush(ctx, fireNow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user