コード例 #1
0
        public override void FireChannelRead(ChannelHandlerContext context, object msg)
        {
            if (msg is ByteBuf)
            {
                List <object> outputList = new List <object>();
                try
                {
                    ByteBuf data = msg as ByteBuf;
                    first = cumulation == null;

                    if (first)
                    {
                        cumulation = data;
                    }
                    else
                    {
                        cumulation = Cumulate(cumulation, data);
                    }
                    CallDecode(context, cumulation, outputList);
                }
                catch (Exception e)
                {
                    throw e;
                }
                finally
                {
                    if (cumulation != null && cumulation.ReadableBytes <= 0)
                    {
                        cumulation.Release();
                        cumulation = null;
                    }

                    if (outputList.Count > 0)
                    {
                        for (int i = 0; i < outputList.Count; i++)
                        {
                            context.FireChannelRead(outputList[i]);
                        }
                    }
                }
            }
            else
            {
                context.FireChannelRead(msg);
            }
        }
コード例 #2
0
 public virtual void FireChannelRead(ChannelHandlerContext context, object msg)
 {
     context.FireChannelRead(msg);
 }