Make sure that setAutoRead(false) has a direct effect and only update interestedOps if needed

This commit is contained in:
Norman Maurer 2013-05-24 12:49:21 +02:00
parent 252bd25855
commit d31ccebd62

View File

@ -50,8 +50,11 @@ public abstract class AbstractNioMessageChannel extends AbstractNioChannel {
assert eventLoop().inEventLoop();
final SelectionKey key = selectionKey();
if (!config().isAutoRead()) {
int interestOps = key.interestOps();
if ((interestOps & readInterestOp) != 0) {
// only remove readInterestOp if needed
key.interestOps(key.interestOps() & ~readInterestOp);
key.interestOps(interestOps & ~readInterestOp);
}
}
final ChannelPipeline pipeline = pipeline();
@ -73,9 +76,13 @@ public abstract class AbstractNioMessageChannel extends AbstractNioChannel {
closed = true;
break loop;
}
if (reads++ > READ_BATCH_SIZE) {
break;
}
if (!config().isAutoRead()) {
break loop;
}
}
} catch (Throwable t) {
if (read) {