Browse Source

Merge pull request #11354 from thalieht/pausechecking

Reallow to pause checking torrents
adaptive-webui-19844
Mike Tzou 5 years ago committed by GitHub
parent
commit
d12468ffb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      src/base/bittorrent/torrenthandle.cpp

21
src/base/bittorrent/torrenthandle.cpp

@ -1497,30 +1497,31 @@ void TorrentHandle::toggleFirstLastPiecePriority() @@ -1497,30 +1497,31 @@ void TorrentHandle::toggleFirstLastPiecePriority()
void TorrentHandle::pause()
{
if (m_startupState != Started) return;
if (m_pauseWhenReady) return;
if (isChecking()) {
m_pauseWhenReady = true;
return;
}
if (isPaused()) return;
setAutoManaged(false);
m_nativeHandle.pause();
if (m_startupState == Started) {
if (m_pauseWhenReady) {
#if (LIBTORRENT_VERSION_NUM < 10200)
m_nativeHandle.stop_when_ready(false);
#else
m_nativeHandle.unset_flags(lt::torrent_flags::stop_when_ready);
#endif
m_pauseWhenReady = false;
}
// Libtorrent doesn't emit a torrent_paused_alert when the
// torrent is queued (no I/O)
// We test on the cached m_nativeStatus
if (isQueued())
m_session->handleTorrentPaused(this);
}
}
void TorrentHandle::resume(bool forced)
{
if (m_startupState != Started) return;
m_pauseWhenReady = false;
resume_impl(forced);
}

Loading…
Cancel
Save