Don't force update torrent status

This commit is contained in:
Vladimir Golovnev (Glassez)
2022-04-22 12:40:31 +03:00
parent 66a5a9863f
commit c740d105c9
4 changed files with 18 additions and 20 deletions

View File

@@ -1654,7 +1654,7 @@ void TorrentImpl::moveStorage(const Path &newPath, const MoveStorageMode mode)
if (m_session->addMoveTorrentStorageJob(this, newPath, mode))
{
m_storageIsMoving = true;
updateStatus();
updateState();
}
}
@@ -1670,13 +1670,16 @@ void TorrentImpl::handleStateUpdate(const lt::torrent_status &nativeStatus)
updateStatus(nativeStatus);
}
void TorrentImpl::handleMoveStorageJobFinished(const bool hasOutstandingJob)
void TorrentImpl::handleMoveStorageJobFinished(const Path &path, const bool hasOutstandingJob)
{
m_session->handleTorrentNeedSaveResumeData(this);
m_storageIsMoving = hasOutstandingJob;
updateStatus();
m_session->handleTorrentSavePathChanged(this);
if (actualStorageLocation() != path)
{
m_nativeStatus.save_path = path.toString().toStdString();
m_session->handleTorrentSavePathChanged(this);
}
if (!m_storageIsMoving)
{
@@ -1690,7 +1693,7 @@ void TorrentImpl::handleMoveStorageJobFinished(const bool hasOutstandingJob)
}
while ((m_renameCount == 0) && !m_moveFinishedTriggers.isEmpty())
m_moveFinishedTriggers.takeFirst()();
std::invoke(m_moveFinishedTriggers.dequeue());
}
}
@@ -2106,11 +2109,6 @@ bool TorrentImpl::isMoveInProgress() const
return m_storageIsMoving;
}
void TorrentImpl::updateStatus()
{
updateStatus(m_nativeHandle.status());
}
void TorrentImpl::updateStatus(const lt::torrent_status &nativeStatus)
{
m_pieces.clear();