AbstractOioByteChannel中的无限循环

时间:2013-09-27 09:30:26

标签: netty

我不确定AbstractOioByteChannel.doWrite(ChannelOutboundBuffer in)中的无限循环是否正确,netty版本4.0.9 谢谢, -Igor

1 个答案:

答案 0 :(得分:0)

如果没有消息

,您似乎需要添加循环中断(下面加粗)
    *for (;;) {
        Object msg = in.current();
        **if (msg == null) {
            break;
        }**
        if (msg instanceof ByteBuf) {
            ....
        } else if (msg instanceof FileRegion) {
            ...
        } else {
            in.remove(new UnsupportedOperationException(
                    "unsupported message type: " + StringUtil.simpleClassName(msg)));
        }
    }*