Esempio n. 1
0
        public void Execute_UpdateServerHeartbeat()
        {
            var server = new ServerHeartbeat(TimeSpan.Zero);

            server.Execute(_context.Object);

            _connection.Verify(x => x.Heartbeat(_context.ServerId));
            _connection.Verify(x => x.Dispose(), Times.Once);
        }
Esempio n. 2
0
        public void Execute_UpdateServerHeartbeat()
        {
            var server = new ServerHeartbeat(ServerHeartbeat.DefaultHeartbeatInterval);

            server.Execute(_context.Object);

            _connection.Verify(x => x.Heartbeat(_context.ServerId));
            _connection.Verify(x => x.Dispose(), Times.Once);
        }
Esempio n. 3
0
        public override void OnLoad(EventArgs e)
        {
            ServerHeartbeat heartbeat = new ServerHeartbeat();

            heartbeat.Name = "Heartbeat test";
            heartbeat.Motd = "Test!";
            heartbeat.Key  = Guid.Empty.ToString();
            heartbeat.Players.Add("A");
            heartbeat.SendHeartbeat();
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            BaseProgram.PubMain1(args, EServerType.世界);

            #region  务器事件

            //新连接事件
            BaseServerInfo.AppServer.NewSessionConnected += new SessionHandler <LunarSession>(Dispatcher.OnSessionConnected);

            //连接断开事件
            BaseServerInfo.AppServer.SessionClosed += new SessionHandler <LunarSession, CloseReason>(Dispatcher.OnSessionClosed);

            //收到消息事件
            BaseServerInfo.AppServer.NewRequestReceived += new RequestHandler <LunarSession, LunarRequestInfo>(BaseDispatch.OnDispatch);

            #endregion  务器事件

            BaseProgram.PubMain2();

            BaseProgram.PubMain3();

            #region 启动服务器后执行服务器数据初始化

            OnServerStart();

            #endregion 启动服务器后执行服务器数据初始化

            #region 添加读取指令的线程

            BaseServerInfo.threadDriverCmds = new Thread(new ThreadStart(DriverCmds.ThreadDriverCmds));
            BaseServerInfo.threadDriverCmds.Start();
            Thread.Sleep(1000);

            #endregion 添加读取指令的线程

            BaseProgram.StartThreadDbMysqlSecond();

            #region 进入主循环

            while (true)
            {
                System.Threading.Thread.CurrentThread.Join(BaseServerInfo.ServerHeartbeat);
                try
                {
                    ServerHeartbeat.Heartbeat();
                }
                catch (Exception ex)
                {
                    loger.Fatal("服务器错误", ex);
                }
            }

            #endregion 进入主循环
        }
Esempio n. 5
0
 public ServerSystemHeartbeat()
 {
     d_Heartbeat = new ServerHeartbeat();
     elapsed = 60;
 }
Esempio n. 6
0
 public ServerSystemHeartbeat()
 {
     d_Heartbeat = new ServerHeartbeat();
     elapsed     = 60;
 }