コード例 #1
0
        /// <summary>
        /// Pauses the TorrentManager
        /// </summary>
        public async Task PauseAsync()
        {
            await ClientEngine.MainLoop;

            CheckRegisteredAndDisposed();
            if (State != TorrentState.Downloading && State != TorrentState.Seeding)
            {
                return;
            }

            // By setting the state to "paused", peers will not be dequeued from the either the
            // sending or receiving queues, so no traffic will be allowed.
            Mode = new PausedMode(this, Engine.DiskManager, Engine.ConnectionManager, Engine.Settings);
            this.SaveFastResume();
        }
コード例 #2
0
        /// <summary>
        /// Pauses the TorrentManager
        /// </summary>
        public void Pause()
        {
            ClientEngine.MainLoop.QueueWait((MainLoopTask) delegate {
                CheckRegisteredAndDisposed();
                if (State != TorrentState.Downloading && State != TorrentState.Seeding)
                {
                    return;
                }

                // By setting the state to "paused", peers will not be dequeued from the either the
                // sending or receiving queues, so no traffic will be allowed.
                Mode = new PausedMode(this);
                this.SaveFastResume();
            });
        }
コード例 #3
0
        /// <summary>
        /// Pauses the TorrentManager
        /// </summary>
        public async Task PauseAsync()
        {
            await ClientEngine.MainLoop;

            CheckRegisteredAndDisposed();

            if (Mode is HashingMode hashing)
            {
                hashing.Pause();
            }
            else if (State == TorrentState.Downloading && State == TorrentState.Seeding)
            {
                Mode = new PausedMode(this, Engine.DiskManager, Engine.ConnectionManager, Engine.Settings);
            }
        }