void SessionOnReceivedMessageBlock(object sender, MessageBlockArgs e)
 {
     if (e.MessageBlock.Type == MessageBlockType.HeartBeat && EnableCheckHeartBeat)
     {
         Session.TimeCounter.Reset(); //Refresh the heart Beat timer
         NetDebuger.PrintDebugMessage(Session, "Recv server heart Beat");
     }
     else
     {
         OnReceivedMessageBlock(e.MessageBlock);
     }
 }
Example #2
0
        void SessionOnReceivedMessageBlock(object sender, MessageBlockArgs e)
        {
            if (EnableCheckHeartBeat)
            {
                if (e.MessageBlock.Type == MessageBlockType.HeartBeat)
                {
                    TSession session = (TSession)sender;
                    //Todo:多线程安全
                    session.TimeCounter.Reset(); //定时器开始新的计时
                    Send(session, e.MessageBlock);
                    NetDebuger.PrintDebugMessage(session, "Heartbeat");
                    return;
                }
            }

            OnReceivedMessageBlock((TSession)sender, e.MessageBlock);
        }