예제 #1
0
        public void ApplicationSignalConstructor()
        {
            tlog.Debug(tag, $"ApplicationSignalConstructor START");

            var testingTarget = new ApplicationSignal();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ApplicationSignal>(testingTarget, "should be an instance of testing target class!");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ApplicationSignalConstructor END (OK)");
        }
예제 #2
0
        public void ApplicationSignalGetConnectionCount()
        {
            tlog.Debug(tag, $"ApplicationSignalGetConnectionCount START");

            var testingTarget = new ApplicationSignal();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ApplicationSignal>(testingTarget, "should be an instance of testing target class!");

            var result = testingTarget.GetConnectionCount();

            Assert.IsTrue(result == 0, "result should be 0");

            testingTarget.Dispose();
            tlog.Debug(tag, $"ApplicationSignalGetConnectionCount END (OK)");
        }
예제 #3
0
        public void ApplicationSignalEmpty()
        {
            tlog.Debug(tag, $"ApplicationSignalEmpty START");

            var testingTarget = new ApplicationSignal();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ApplicationSignal>(testingTarget, "should be an instance of testing target class!");

            var result = testingTarget.Empty();

            Assert.IsTrue(result);

            testingTarget.Dispose();
            tlog.Debug(tag, $"ApplicationSignalEmpty END (OK)");
        }
예제 #4
0
        public void ApplicationSignalDisconnection()
        {
            tlog.Debug(tag, $"ApplicationSignalDisconnection START");

            var testingTarget = new ApplicationSignal();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <ApplicationSignal>(testingTarget, "should be an instance of testing target class!");

            dummyCallback callback = OnDummyCallback;

            testingTarget.Connect(callback);
            testingTarget.Disconnect(callback);
            testingTarget.Dispose();

            tlog.Debug(tag, $"ApplicationSignalDisconnection END (OK)");
        }
예제 #5
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ApplicationSignal obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
예제 #6
0
        static void Main()
        {
            ApplicationSignal.SetConsoleCtrlHandler(AbortHandler, true);
            ApplicationSignal.RemoveConsoleQuickEditMode();

            if (!ConfigMgr.Load(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".conf"))
            {
                ExitNow();
            }

            testing();

            // Initialize the database connection
            if (!StartDB())
            {
                ExitNow();
            }

            string bindIp = ConfigMgr.GetDefaultValue("BindIP", "0.0.0.0");

            var restSocketServer = new SocketManager <RestSession>();
            int restPort         = ConfigMgr.GetDefaultValue("LoginREST.Port", 8081);

            if (restPort < 0 || restPort > 0xFFFF)
            {
                Log.outError(LogFilter.Network, "Specified login service port ({0}) out of allowed range (1-65535), defaulting to 8081", restPort);
                restPort = 8081;
            }

            if (!restSocketServer.StartNetwork(bindIp, restPort))
            {
                Log.outError(LogFilter.Server, "Failed to initialize Rest Socket Server");
                ExitNow();
            }

            // Get the list of realms for the server
            Global.RealmMgr.Initialize(ConfigMgr.GetDefaultValue("RealmsStateUpdateDelay", 10));
            Global.SessionMgr.Initialize();

            var sessionSocketServer = new SocketManager <Session>();
            // Start the listening port (acceptor) for auth connections
            int bnPort = ConfigMgr.GetDefaultValue("BattlenetPort", 1119);

            if (bnPort < 0 || bnPort > 0xFFFF)
            {
                Log.outError(LogFilter.Server, "Specified battle.net port ({0}) out of allowed range (1-65535)", bnPort);
                ExitNow();
            }

            if (!sessionSocketServer.StartNetwork(bindIp, bnPort))
            {
                Log.outError(LogFilter.Network, "Failed to start BnetServer Network");
                ExitNow();
            }

            uint _banExpiryCheckInterval = ConfigMgr.GetDefaultValue("BanExpiryCheckInterval", 60u);

            _banExpiryCheckTimer          = new Timer(_banExpiryCheckInterval);
            _banExpiryCheckTimer.Elapsed += _banExpiryCheckTimer_Elapsed;

            while (true)
            {
                ;
            }
        }
예제 #7
0
        static void Main()
        {
            ApplicationSignal.SetConsoleCtrlHandler(AbortHandler, true);
            ApplicationSignal.RemoveConsoleQuickEditMode();

            if (!ConfigMgr.Load(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".conf"))
            {
                ExitNow();
            }

            var WorldSocketMgr = new WorldSocketManager();

            //AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; // Watch for any unhandled exceptions.

            if (!StartDB())
            {
                ExitNow();
            }

            Testing();

            // set server offline (not connectable)
            DB.Login.Execute("UPDATE realmlist SET flag = (flag & ~{0}) | {1} WHERE id = '{2}'", (uint)RealmFlags.VersionMismatch, (uint)RealmFlags.Offline, Global.WorldMgr.GetRealm().Id.Realm);

            Global.RealmMgr.Initialize(ConfigMgr.GetDefaultValue("RealmsStateUpdateDelay", 10));

            Global.WorldMgr.SetInitialWorldSettings();

            // Launch the worldserver listener socket
            int    worldPort     = WorldConfig.GetIntValue(WorldCfg.PortWorld);
            string worldListener = ConfigMgr.GetDefaultValue("BindIP", "0.0.0.0");

            int networkThreads = ConfigMgr.GetDefaultValue("Network.Threads", 1);

            if (networkThreads <= 0)
            {
                Log.outError(LogFilter.Server, "Network.Threads must be greater than 0");
                ExitNow();
                return;
            }

            if (!WorldSocketMgr.StartNetwork(worldListener, worldPort, networkThreads))
            {
                Log.outError(LogFilter.Network, "Failed to start Realm Network");
                ExitNow();
            }

            // set server online (allow connecting now)
            DB.Login.Execute("UPDATE realmlist SET flag = flag & ~{0}, population = 0 WHERE id = '{1}'", (uint)RealmFlags.Offline, Global.WorldMgr.GetRealm().Id.Realm);
            Global.WorldMgr.GetRealm().PopulationLevel = 0.0f;
            Global.WorldMgr.GetRealm().Flags           = Global.WorldMgr.GetRealm().Flags & ~RealmFlags.VersionMismatch;

            //- Launch CliRunnable thread
            if (ConfigMgr.GetDefaultValue("Console.Enable", true))
            {
                Thread commandThread = new Thread(CommandManager.InitConsole);
                commandThread.Start();
            }

            WorldUpdateLoop();

            try
            {
                // Shutdown starts here
                Global.WorldMgr.KickAll();                                     // save and kick all players
                Global.WorldMgr.UpdateSessions(1);                             // real players unload required UpdateSessions call

                // unload Battlegroundtemplates before different singletons destroyed
                Global.BattlegroundMgr.DeleteAllBattlegrounds();

                WorldSocketMgr.StopNetwork();

                Global.MapMgr.UnloadAll();                     // unload all grids (including locked in memory)
                Global.ScriptMgr.Unload();

                // set server offline
                DB.Login.Execute("UPDATE realmlist SET flag = flag | {0} WHERE id = '{1}'", (uint)RealmFlags.Offline, Global.WorldMgr.GetRealm().Id.Realm);
                Global.RealmMgr.Close();

                ClearOnlineAccounts();

                ExitNow();
            }
            catch (Exception ex)
            {
                Log.outException(ex);
            }
        }