Ejemplo n.º 1
0
        public void Tick()
        {
            IServer.Instance.Tick();
            try
            {
                UserRoleManager.Tick();
            }
            catch (System.Exception ex)
            {
                Log.Log.Common.Print(ex.ToString());
                Log.Log.Common.Print(ex.StackTrace.ToString());
            }


            var time = IServer.timeGetTime();

            if (mLinkState == ComServerState.WaitRegServer)
            {
                //每过一段时间尝试连接一次
                if (mRegisterConnect.State != Iocp.NetState.Connect)
                {
                    if (time - mTryRegServerReconnectTime > 3000)
                    {
                        mTryRegServerReconnectTime = time;
                        mRegisterConnect.Reconnect();
                    }
                }
            }
            else if (mLinkState == ComServerState.Working)
            {
                if (mRegisterConnect.State == Iocp.NetState.Disconnect || mRegisterConnect.State == Iocp.NetState.Invalid)
                {
                    if (time - mTryRegServerReconnectTime > 3000)
                    {
                        mTryRegServerReconnectTime = time;
                        mRegisterConnect.Reconnect();
                    }
                }
            }
            this.UserRoleManager.DBConnect.Tick();
            mRegisterConnect.Update();
            mTcpSrv.Update();
            RPC.RPCNetworkMgr.Instance.Tick(IServer.Instance.GetElapseMilliSecondTime());
        }