Example #1
0
        public void Start()
        {
            if (_Status == GameSrvStatus.Paused)
            {
                // If we're paused, call Pause() again to un-pause
                Pause();
            }
            else if (_Status == GameSrvStatus.Stopped)
            {
                // Clean up the files not needed by this platform
                Helpers.CleanUpFiles();

                // Check for 3rd party software
                Helpers.CheckFor3rdPartySoftware();

                // Load the Global settings
                Config.Instance.Init();

                // Start the node manager
                NodeManager.Start();

                // Start the server threads
                ServerThreadManager.StartThreads();

                // Start the ignored ips thread
                IgnoredIPsThread.StartThread();

                // Start the timed events thread
                TimedEventsThread.StartThread();

                // Drop root, if necessary
                try {
                    Helpers.DropRoot(Config.Instance.UnixUser);
                } catch (ArgumentOutOfRangeException aoorex) {
                    RMLog.Exception(aoorex, "Unable to drop from root to '" + Config.Instance.UnixUser + "'");

                    // Undo previous actions on error
                    TimedEventsThread.StopThread();
                    IgnoredIPsThread.StopThread();
                    ServerThreadManager.StopThreads();
                    NodeManager.Stop();

                    // If we get here, we failed to go online
                    UpdateStatus(GameSrvStatus.Stopped);
                    return;
                }

                // If we get here, we're online
                UpdateStatus(GameSrvStatus.Started);
            }
        }
Example #2
0
        // TODOX I don't really like this shutdown parameter, or the Offline vs Stopped states.  Need to make that more clear
        public void Stop()
        {
            if ((_Status == GameSrvStatus.Paused) || (_Status == GameSrvStatus.Started))
            {
                UpdateStatus(GameSrvStatus.Stopping);

                TimedEventsThread.StopThread();
                IgnoredIPsThread.StopThread();
                ServerThreadManager.StopThreads();
                NodeManager.Stop();

                UpdateStatus(GameSrvStatus.Stopped);
            }
        }
Example #3
0
        private bool _Disposed = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!_Disposed)
            {
                if (disposing)
                {
                    // dispose managed state (managed objects).
                    TimedEventsThread.StopThread();
                    IgnoredIPsThread.StopThread();
                    ServerThreadManager.StopThreads();
                    if (_LogHandler != null)
                    {
                        _LogHandler.Dispose();
                        _LogHandler = null;
                    }
                }

                // free unmanaged resources (unmanaged objects) and override a finalizer below.
                // set large fields to null.

                _Disposed = true;
            }
        }