Example #1
0
        public override void OnChannelRead(IChannelHandlerContext context, object message)
        {
            Ensure.IsNotNull(message);

            List <object> output = new List <object>();

            if (message is T)
            {
                try
                {
                    Decode(context, (T)message, output);
                }
                catch (IndexOutOfRangeException e)
                {
                    Trace.WriteLine($"MessageDecoder.IndexOutOfRangeException");
                }
            }

            if (output != null)
            {
                for (int i = 0; i < output.Count; i++)
                {
                    object msg = output[i];
                    context.fireChannelRead(msg);
                    Return((T)msg);
                }
            }
            else
            {
                context.fireChannelRead(message);
            }
        }
Example #2
0
        public override void OnChannelRead(IChannelHandlerContext ctx, object message)
        {
            var channel = (IChannel)message;

            //初始化新的Channel
            InitNewChannel(channel);

            ctx.fireChannelRead(message);
        }