Browse Source

Improve finished torrent handling

PR #18704.
Closes #18694.
adaptive-webui-19844
Vladimir Golovnev 2 years ago committed by GitHub
parent
commit
989b1e6c2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      src/base/bittorrent/torrentimpl.cpp

15
src/base/bittorrent/torrentimpl.cpp

@ -1866,24 +1866,23 @@ void TorrentImpl::handleTorrentFinishedAlert(const lt::torrent_finished_alert *p
m_statusUpdatedTriggers.enqueue([this]() m_statusUpdatedTriggers.enqueue([this]()
{ {
m_hasFinishedStatus = true;
adjustStorageLocation(); adjustStorageLocation();
manageIncompleteFiles(); manageIncompleteFiles();
m_session->handleTorrentNeedSaveResumeData(this); m_session->handleTorrentNeedSaveResumeData(this);
const bool recheckTorrentsOnCompletion = Preferences::instance()->recheckTorrentsOnCompletion(); const bool recheckTorrentsOnCompletion = Preferences::instance()->recheckTorrentsOnCompletion();
if (isMoveInProgress() || (m_renameCount > 0)) if (recheckTorrentsOnCompletion && m_unchecked)
{ {
if (recheckTorrentsOnCompletion) forceRecheck();
m_moveFinishedTriggers.enqueue([this]() { forceRecheck(); });
m_moveFinishedTriggers.enqueue([this]() { m_session->handleTorrentFinished(this); });
} }
else else
{ {
if (recheckTorrentsOnCompletion && m_unchecked) m_hasFinishedStatus = true;
forceRecheck();
if (isMoveInProgress() || (m_renameCount > 0))
m_moveFinishedTriggers.enqueue([this]() { m_session->handleTorrentFinished(this); });
else
m_session->handleTorrentFinished(this); m_session->handleTorrentFinished(this);
} }
}); });

Loading…
Cancel
Save