mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Merge pull request #11472 from thalieht/backport_pausechecking
Backport
This commit is contained in:
commit
0b055d8fef
1 changed files with 16 additions and 18 deletions
|
@ -1273,17 +1273,18 @@ void TorrentHandle::forceDHTAnnounce()
|
||||||
|
|
||||||
void TorrentHandle::forceRecheck()
|
void TorrentHandle::forceRecheck()
|
||||||
{
|
{
|
||||||
if (m_startupState != Started) return;
|
|
||||||
if (!hasMetadata()) return;
|
if (!hasMetadata()) return;
|
||||||
|
|
||||||
m_nativeHandle.force_recheck();
|
m_nativeHandle.force_recheck();
|
||||||
m_unchecked = false;
|
m_unchecked = false;
|
||||||
|
|
||||||
if (isPaused()) {
|
if ((m_startupState != Started) || isPaused()) {
|
||||||
m_nativeHandle.stop_when_ready(true);
|
m_nativeHandle.stop_when_ready(true);
|
||||||
m_nativeHandle.auto_managed(true);
|
m_nativeHandle.auto_managed(true);
|
||||||
m_pauseWhenReady = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((m_startupState == Started) && isPaused())
|
||||||
|
m_pauseWhenReady = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentHandle::setSequentialDownload(bool b)
|
void TorrentHandle::setSequentialDownload(bool b)
|
||||||
|
@ -1351,30 +1352,27 @@ 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;
|
||||||
|
|
||||||
m_nativeHandle.auto_managed(false);
|
m_nativeHandle.auto_managed(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
|
m_nativeHandle.stop_when_ready(false);
|
||||||
if (isQueued())
|
m_pauseWhenReady = false;
|
||||||
m_session->handleTorrentPaused(this);
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue