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:
parent
256621246c
commit
b89487c445
@ -152,34 +152,36 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
|
||||
private void discard(ChannelHandlerContext ctx) {
|
||||
ClosedChannelException cause = null;
|
||||
boolean fireExceptionCaught = false;
|
||||
synchronized (this) {
|
||||
for (;;) {
|
||||
if (currentEvent == null) {
|
||||
currentEvent = queue.poll();
|
||||
}
|
||||
|
||||
if (currentEvent == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
MessageEvent currentEvent = this.currentEvent;
|
||||
this.currentEvent = null;
|
||||
|
||||
Object m = currentEvent.getMessage();
|
||||
if (m instanceof ChunkedInput) {
|
||||
closeInput((ChunkedInput) m);
|
||||
}
|
||||
|
||||
// Trigger a ClosedChannelException
|
||||
if (cause == null) {
|
||||
cause = new ClosedChannelException();
|
||||
}
|
||||
currentEvent.getFuture().setFailure(cause);
|
||||
fireExceptionCaught = true;
|
||||
|
||||
currentEvent = null;
|
||||
|
||||
for (;;) {
|
||||
MessageEvent currentEvent = this.currentEvent;
|
||||
|
||||
if (this.currentEvent == null) {
|
||||
currentEvent = queue.poll();
|
||||
} else {
|
||||
this.currentEvent = null;
|
||||
}
|
||||
|
||||
if (currentEvent == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Object m = currentEvent.getMessage();
|
||||
if (m instanceof ChunkedInput) {
|
||||
closeInput((ChunkedInput) m);
|
||||
}
|
||||
|
||||
// Trigger a ClosedChannelException
|
||||
if (cause == null) {
|
||||
cause = new ClosedChannelException();
|
||||
}
|
||||
currentEvent.getFuture().setFailure(cause);
|
||||
fireExceptionCaught = true;
|
||||
|
||||
currentEvent = null;
|
||||
}
|
||||
|
||||
|
||||
if (fireExceptionCaught) {
|
||||
Channels.fireExceptionCaught(ctx.getChannel(), cause);
|
||||
|
Loading…
Reference in New Issue
Block a user