Inheritance: Session
Example #1
0
        public override Session CreateSession(Peer peer, Cookie cookie)
        {
            var target = _pCirrus;

            if (_middle)
            {
                if (cookie.Target == null)
                {
                    cookie.Target = new Target(peer.Address, cookie)
                    {
                        PeerId = peer.Id
                    };
                    peer.Id = cookie.Target.Id;
                }
                else
                {
                    target = cookie.Target;
                }
            }
            Session session;

            if (target != null)
            {
                session = new Middle(peer, cookie.CookieComputing.DecryptKey, cookie.CookieComputing.EncryptKey, target)
                {
                    Handler     = this,
                    FarId       = cookie.FarId,
                    Application = Application
                };
                //if (_pCirrus == target) session.Target = cookie.Target;
                //session.Manage();
            }
            else
            {
                session = new Session(peer, cookie.CookieComputing.DecryptKey, cookie.CookieComputing.EncryptKey)
                {
                    Handler     = this,
                    Target      = cookie.Target,
                    FarId       = cookie.FarId,
                    Application = Application
                };
            }
            Logger.Debug("FarId:{0}", session.FarId);
            Sessions[session.Id] = session;
            return(session);
        }
 public override Session CreateSession(Peer peer, Cookie cookie)
 {
     var target = _pCirrus;
     if (_middle)
     {
         if (cookie.Target == null)
         {
             cookie.Target = new Target(peer.Address,cookie) {PeerId = peer.Id};
             peer.Id = cookie.Target.Id;
         }
         else
         {
             target = cookie.Target;
         }
     }
     Session session;
     if (target != null)
     {
         session = new Middle(peer, cookie.CookieComputing.DecryptKey, cookie.CookieComputing.EncryptKey, target)
         {
             Handler = this,
             FarId = cookie.FarId,
             Application = Application
         };
         //if (_pCirrus == target) session.Target = cookie.Target;
         //session.Manage();
     }
     else
     {
         session = new Session(peer, cookie.CookieComputing.DecryptKey, cookie.CookieComputing.EncryptKey)
         {
             Handler = this,
             Target = cookie.Target,
             FarId = cookie.FarId,
             Application = Application
         };
     }
     Logger.Debug("FarId:{0}",session.FarId);
     Sessions[session.Id] = session;
     return session;
 }