Example #1
0
 /// <summary>
 /// 启动心跳检查功能
 /// </summary>
 protected override void OnStart()
 {
     if (EnableCheckHeartBeat)
     {
         {
             checkTimer = new Timer(new TimerCallback(CheckHeartBeatCallBack), null,
                                    HeartBeatPeriod, HeartBeatPeriod);
             NetDebuger.PrintDebugMessage("Start heartbeat checker, Period:" + HeartBeatPeriod + "(ms)");
         }
     }
 }
Example #2
0
 /// <summary>
 /// 停止检查心跳功能
 /// </summary>
 protected override void OnStop()
 {
     if (EnableCheckHeartBeat && checkTimer != null)
     {
         lock (checkTimer)
         {
             if (EnableCheckHeartBeat && checkTimer != null)
             {
                 NetDebuger.PrintDebugMessage("Stop heartbeat checker");
                 checkTimer.Dispose();
                 checkTimer = null;
             }
         }
     }
 }