Пример #1
0
        public void InitNewChannel(IChannel channel)
        {
            var loop = Group.Next();

            channel.SetConfig(ChannelConfig).SetPipeline(PipelineAction);

            //将Channel注册到Eventloop中
            loop.Register(channel);

            //激活channel
            channel.ActiveAsync();
        }
Пример #2
0
        public override void OnChannelRead(IChannelHandlerContext context, object message)
        {
            if (message is IChannel)
            {
                IChannel channel = message as IChannel;

                var loop = Group.Next();

                channel.SetConfig(ChannelConfig).Pipeline.SetAlloc(loop.Alloc);

                //配置Pipeline
                channel.SetPipeline(PipelineAction);

                //将channel注册到Eventloop
                loop.Register(channel);

                //异步执行激活
                channel.ActiveAsync();
            }
        }