Add patch of NETTY-434 to the mix to fix Deadlock in

ChunkedWriteHandler. This patch was not written by me...
This commit is contained in:
Norman Maurer 2011-09-30 22:14:36 +02:00
parent a78d37460c
commit ed30037098

View File

@ -152,18 +152,20 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
private void discard(ChannelHandlerContext ctx) {
ClosedChannelException cause = null;
boolean fireExceptionCaught = false;
synchronized (this) {
for (;;) {
if (currentEvent == null) {
MessageEvent currentEvent = this.currentEvent;
if (this.currentEvent == null) {
currentEvent = queue.poll();
} else {
this.currentEvent = null;
}
if (currentEvent == null) {
break;
}
MessageEvent currentEvent = this.currentEvent;
this.currentEvent = null;
Object m = currentEvent.getMessage();
if (m instanceof ChunkedInput) {
@ -179,7 +181,7 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
currentEvent = null;
}
}
if (fireExceptionCaught) {
Channels.fireExceptionCaught(ctx.getChannel(), cause);