Ejemplo n.º 1
0
        /// <summary>
        /// Uninitializes the torrent engine.
        /// </summary>
        public static void Uninitialize()
        {
            if (!isInitialized)
            {
                return;
            }

            Log.LogInfo("[Engine] Shutting down TorrentEngine.");

            isInitialized = false;
            isStopping    = true;
            workQueueResetEvent.Set();

            TorrentRegistry.StopAllActiveTorrents();
            PeerListener.StopListening();
            LocalPeerListener.StopListening();
            LocalPeerDiscovery.Uninitialize();
            DiskManager.Uninitialize();

            if (engineThread != null)
            {
                engineThread.Join();
                engineThread = null;
            }
        }