Exemple #1
0
        private bool CheckSpecialPackge(RequestPackage package, GameSession session)
        {
            //处理特殊包
            if (package.ActionId == ((int)ActionEnum.Interrupt))
            {
                //Proxy server notifly interrupt connect ops
                OnDisconnected(session);
                if (session != null && (session.ProxySid == Guid.Empty || GameSession.Count > 1))
                {
                    //保留代理服连接
                    session.Close();
                    session.ProxySid = Guid.Empty;
                }
                return(true);
            }

            if (package.ActionId == ((int)ActionEnum.Heartbeat))
            {
                if (session != null)
                {
                    // 客户端tcp心跳包
                    session.Refresh();
                    OnHeartbeat(session);
                    session.ExitSession();
                }
                return(true);
            }
            return(false);
        }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="session"></param>
 public void Bind(GameSession session)
 {
     if (session != null)
     {
         SessionId       = session.SessionId;
         session.ProxyId = ProxyId;
         //push not refresh
         if (MsgId > 0)
         {
             session.Refresh();
         }
     }
     //Session = session;
     ReceiveTime = DateTime.Now;
 }
Exemple #3
0
        private bool CheckSpecialPackge(RequestPackage package, GameSession session)
        {
            //处理特殊包
            if (package.ActionId == ((int)ActionEnum.Interrupt))
            {
                //Proxy server notifly interrupt connect ops
                OnDisconnected(session);
                if (session != null && (session.ProxySid == Guid.Empty || GameSession.Count > 1))
                {
                    //保留代理服连接
                    session.Close();
                    session.ProxySid = Guid.Empty;
                }
                return true;
            }

            if (package.ActionId == ((int)ActionEnum.Heartbeat))
            {
                // 客户端tcp心跳包
                session.Refresh();
                OnHeartbeat(session);
                session.ExitSession();
                Interlocked.Decrement(ref runningNum);
                return true;
            }
            return false;
        }
Exemple #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="package"></param>
        /// <param name="session"></param>
        /// <returns></returns>
        protected virtual bool CheckSpecialPackge(RequestPackage package, GameSession session)
        {
            //处理特殊包
            if (package.ActionId == ((int)ActionEnum.Interrupt))
            {
                //Proxy server notifly interrupt connect ops
                OnDisconnected(session);
                if (session != null && (session.ProxySid == Guid.Empty || GameSession.Count > 1))
                {
                    //保留代理服连接
                    session.Close();
                    session.ProxySid = Guid.Empty;
                }
                return true;
            }

            if (package.ActionId == ((int)ActionEnum.Heartbeat))
            {
                if (session != null)
                {
                    // 客户端tcp心跳包
                    session.Refresh();
                    OnHeartbeat(session);
                    BuildHearbeatPackage(package, session);
                    session.ExitSession();
                }
                return true;
            }
            return false;
        }
Exemple #5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="session"></param>
 public void Bind(GameSession session)
 {
     if (session != null)
     {
         SessionId = session.SessionId;
         session.ProxyId = ProxyId;
         //push not refresh
         if (MsgId > 0) session.Refresh();
     }
     //Session = session;
     ReceiveTime = DateTime.Now;
 }