예제 #1
0
        public void Decode(IClient client, Stream stream)
        {
            PipeStream pstream = stream.ToPipeStream();

            while (true)
            {
                if (mPacket == null)
                {
                    mPacket        = new RPCPacket();
                    mPacket.Client = (AsyncTcpClient)client;
                }
                if (mPacket.Read(Options, pstream))
                {
                    try
                    {
                        Completed?.Invoke(client, mPacket);
                    }
                    finally
                    {
                        mPacket = null;
                    }
                }
                else
                {
                    return;
                }
            }
        }
예제 #2
0
        public void Decode(ISession session, Stream stream)
        {
            PipeStream pstream = stream.ToPipeStream();

            while (true)
            {
                if (mRequest == null)
                {
                    mRequest        = new RPCPacket();
                    mRequest.Sesion = session;
                }
                if (mRequest.Read(Options, pstream))
                {
                    mCompletedArgs.SetInfo(session, mRequest);
                    try
                    {
                        Completed?.Invoke(this, mCompletedArgs);
                    }
                    finally
                    {
                        mRequest = null;
                    }
                }
                else
                {
                    return;
                }
            }
        }