Fixed a problem in ChunkedWriteHandler where channelInterestOpsChanged event is not propagated properly

This commit is contained in:
Trustin Lee 2009-06-16 10:44:03 +00:00
parent 4f4cf07760
commit 373cd52012

View File

@ -73,20 +73,15 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e)
throws Exception {
if (!(e instanceof ChannelStateEvent)) {
ctx.sendUpstream(e);
return;
}
ChannelStateEvent cse = (ChannelStateEvent) e;
if (cse.getState() != ChannelState.INTEREST_OPS) {
ctx.sendUpstream(e);
return;
}
if (ctx.getChannel().isWritable()) {
flushWriteEventQueue(ctx);
if (e instanceof ChannelStateEvent) {
ChannelStateEvent cse = (ChannelStateEvent) e;
if (cse.getState() == ChannelState.INTEREST_OPS &&
ctx.getChannel().isWritable()) {
// Continue writing when the channel becomes writable.
flushWriteEventQueue(ctx);
}
}
ctx.sendUpstream(e);
}
private synchronized void flushWriteEventQueue(ChannelHandlerContext ctx) throws Exception {