CommitCookie() public method

public CommitCookie ( byte value ) : void
value byte
return void
Example #1
0
        public override bool SignalInputData(InputStream inputStream, IPEndPoint address)
        {
            //inputStream.CopyDataTo(OutputBuffer, (int)inputStream.AvaliableByteCounts);
            //if (!Connections.ContainsKey(address))
            //{
            //    Connections[address] = new Middle2ServerRTMFPProtocol
            //    {
            //        Application = Application,
            //        LocalEndPoint = address,
            //        Middle = this,
            //        ServerEndPoint = new IPEndPoint(IPAddress.Parse("202.109.143.196"), 19352)
            //    };
            //    Connections[address].Start();
            //}
            //Connections[address].EnqueueForOutbound(OutputBuffer);

            var reader = inputStream.Reader;
            var id     = reader.ReadUInt32() ^ reader.ReadUInt32() ^ reader.ReadUInt32();

            reader.BaseStream.Position = 4;
            var session = id == 0 ? HandShakeSession : Sessions.ContainsKey(id) ? Sessions[id] : null;

            if (session == null)
            {
                Debug.WriteLine($"unknown session {id}");
                FarProtocol.InputBuffer.Recycle(true);
                return(true);
            }
            session.Decode(reader);

            if (!session.Checked)
            {
                session.Checked = true;
                var pCookieComputing = session.Peer.GetUserState <CookieComputing>();
                HandShakeSession.CommitCookie(pCookieComputing.Value);
            }
            //reader.Read24();
            //id = reader.ReadByte();
            //Logger.Debug("{0:X}", id);


            session.SetEndPoint(address);
            lock (session.OutputBuffer)
            {
                session.PacketHandler(reader);
            }
            FarProtocol.InputBuffer.Recycle(true);
            return(true);
        }