1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-10 14:57:52 +00:00

Reallow to pause checking torrents

This commit is contained in:
thalieht 2019-10-10 13:18:40 +03:00
parent c7f092b95f
commit f150b3077d

View File

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