Skip to content

研究学习 #9

Description

@hegaoye

代码跑了下,手机测试无法使用,进去后直接进入

 protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
        boolean isUdp = ctx.channel().attr(SSCommon.IS_UDP).get();

        if (isUdp) {
            DatagramPacket udpRaw = ((DatagramPacket) msg);
            if (udpRaw.content().readableBytes() < 4) { //no cipher, min size = 1 + 1 + 2 ,[1-byte type][variable-length host][2-byte port]
                return;
            }
            ctx.channel().attr(SSCommon.RemoteAddr).set(udpRaw.sender());
            ctx.fireChannelRead(udpRaw.content());
        } else {
            ctx.channel().attr(SSCommon.RemoteAddr).set((InetSocketAddress) ctx.channel().remoteAddress());
            ctx.channel().pipeline().remove(this);
            ctx.fireChannelRead(msg);
        }
    }

总是进入到else然后测试中就没有结果了,我们的网络可以直接访问google的结果不行了。。。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions