Пример #1
0
 /// <summary>
 /// 检测在协议发起前是否发送过心跳协议
 /// </summary>
 /// <param name="state">传递对象</param>
 public static void CheckIsChange(Object state)
 {
     try
     {
         UploadCheck UC = (UploadCheck)state;
         if (!OnLineUser.IsUserOnLine(UC.Mac))
         {
             User u = new User();
             u.sessionId = UC.sessionId;
             u.MAC       = UC.Mac;
             //u.IP = UC.IP;
             //u.Port = UC.Port;
             u.AddDate = u.LastOPDate = DateTime.Now;
             u.Type    = UC.Type;
             OnLineUser.AddUserToOnLine(u);
         }
     }
     catch (Exception ex)
     {
         logger.Error("error:" + ex.Message);
     }
 }
Пример #2
0
        /// <summary>
        /// 检测客户端或网关是否加入缓存
        /// </summary>
        /// <param name="SessionID">SessionID</param>
        /// <param name="Mac">Mac</param>
        /// <param name="Address">Address</param>
        /// <param name="Port">Port</param>
        /// <param name="Type">类型</param>
        public static void CheckIsJoinChache(string SessionID, string Mac, byte Type)
        {
            try
            {
                if (DateTime.Now.Ticks - AsyncManager.StartTicks > CheckLong)
                {
                    OnLineNews.IsInitial = false;
                }


                UploadCheck UC = new UploadCheck();
                UC.sessionId = SessionID;
                UC.Mac       = Mac;
                //UC.IP = Address;
                //UC.Port = Port;
                UC.Type = Type;
                ThreadPool.UnsafeQueueUserWorkItem(new WaitCallback(OnLineNews.CheckIsChange), UC);
            }
            catch (Exception ex)
            {
                logger.Error("error:" + ex.Message);
            }
        }