コード例 #1
0
ファイル: GameSrv.cs プロジェクト: dunnaway/GameSrv
        private bool StopIgnoredIPsThread()
        {
            if (_IgnoredIPsThread != null)
            {
                RaiseStatusMessageEvent("Stopping Ignored IPs Thread");

                try
                {
                    _IgnoredIPsThread.Stop();
                    _IgnoredIPsThread.Dispose();
                    _IgnoredIPsThread = null;

                    return(true);
                }
                catch (Exception ex)
                {
                    RaiseExceptionEvent("Error in GameSrv::StopIgnoredIPsThread()", ex);
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
ファイル: IgnoredIPsThread.cs プロジェクト: orf53975/GameSrv
        public static void StartThread()
        {
            RMLog.Info("Starting Ignored IPs Thread");

            try {
                // Create Ignored IPs Thread and Thread objects
                _IgnoredIPsThread = new IgnoredIPsThread();
                _IgnoredIPsThread.Start();
            } catch (Exception ex) {
                RMLog.Exception(ex, "Error in IgnoredIPsThread::StartThread()");
            }
        }
コード例 #3
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);
            }
        }
コード例 #4
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);
            }
        }
コード例 #5
0
ファイル: IgnoredIPsThread.cs プロジェクト: orf53975/GameSrv
        public static void StopThread()
        {
            RMLog.Info("Stopping Ignored IPs Thread");

            if (_IgnoredIPsThread != null)
            {
                try {
                    _IgnoredIPsThread.Stop();
                    _IgnoredIPsThread.Dispose();
                    _IgnoredIPsThread = null;
                } catch (Exception ex) {
                    RMLog.Exception(ex, "Error in IgnoredIPsThread::StopThread()");
                }
            }
        }
コード例 #6
0
ファイル: GameSrv.cs プロジェクト: dunnaway/GameSrv
        private bool StartIgnoredIPsThread()
        {
            RaiseStatusMessageEvent("Starting Ignored IPs Thread");

            try
            {
                // Create Ignored IPs Thread and Thread objects
                _IgnoredIPsThread = new IgnoredIPsThread();
                _IgnoredIPsThread.ExceptionEvent += IgnoredIPsThread_ExceptionEvent;
                _IgnoredIPsThread.Start();
                return(true);
            }
            catch (Exception ex)
            {
                RaiseExceptionEvent("Error in GameSrv::StartIgnoredIPsThread()", ex);
                return(false);
            }
        }
コード例 #7
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;
            }
        }