Ejemplo n.º 1
0
        /// <summary>
        /// Stops the reflector.
        /// </summary>
        public void StopReflector()
        {
            isRunning = false;

            try
            {
                regServer.StopThreads();
                UMforwarder.StopThreads();
                MUforwarder.StopThreads();
                sockets.DisposeAll();
                pC.Dispose();
                pC = null;
                eventLog.WriteEntry("ReflectorService stopped", EventLogEntryType.Information,
                                    (int)ReflectorEventLog.ID.ServiceStopped);
            }
            // On stopping the service, avoid the AbortException written in the event viewer
            catch (ThreadAbortException) {}
            catch (Exception e)
            {
                eventLog.WriteEntry("ReflectorService stopping exception" + e.ToString(), EventLogEntryType.Warning,
                                    (int)ReflectorEventLog.ID.ThreadStoppingException);
            }
        }