mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 04:54:18 +00:00
Fetch torrent status when generating final fastresume data
This is done to get correct queue position, which has to be written into the fastresume file. See discussion in #6154.
This commit is contained in:
parent
6cd233dd61
commit
b6e64c13d8
@ -1858,7 +1858,7 @@ void Session::generateResumeData(bool final)
|
||||
if (torrent->isChecking() || torrent->hasError()) continue;
|
||||
if (!final && !torrent->needSaveResumeData()) continue;
|
||||
|
||||
saveTorrentResumeData(torrent);
|
||||
saveTorrentResumeData(torrent, final);
|
||||
qDebug("Saving fastresume data for %s", qPrintable(torrent->name()));
|
||||
}
|
||||
}
|
||||
@ -2782,9 +2782,9 @@ void Session::handleTorrentRatioLimitChanged(TorrentHandle *const torrent)
|
||||
updateRatioTimer();
|
||||
}
|
||||
|
||||
void Session::saveTorrentResumeData(TorrentHandle *const torrent)
|
||||
void Session::saveTorrentResumeData(TorrentHandle *const torrent, bool finalSave)
|
||||
{
|
||||
torrent->saveResumeData();
|
||||
torrent->saveResumeData(finalSave);
|
||||
++m_numResumeData;
|
||||
}
|
||||
|
||||
|
@ -467,7 +467,7 @@ namespace BitTorrent
|
||||
|
||||
void updateRatioTimer();
|
||||
void exportTorrentFile(TorrentHandle *const torrent, TorrentExportFolder folder = TorrentExportFolder::Regular);
|
||||
void saveTorrentResumeData(TorrentHandle *const torrent);
|
||||
void saveTorrentResumeData(TorrentHandle *const torrent, bool finalSave = false);
|
||||
|
||||
void handleAlert(libtorrent::alert *a);
|
||||
void dispatchTorrentAlert(libtorrent::alert *a);
|
||||
|
@ -485,8 +485,11 @@ bool TorrentHandle::needSaveResumeData() const
|
||||
SAFE_RETURN(bool, need_save_resume_data, false);
|
||||
}
|
||||
|
||||
void TorrentHandle::saveResumeData()
|
||||
void TorrentHandle::saveResumeData(bool updateStatus)
|
||||
{
|
||||
if (updateStatus) // to update queue_position, see discussion in PR #6154
|
||||
this->updateStatus();
|
||||
|
||||
SAFE_CALL(save_resume_data);
|
||||
m_needSaveResumeData = false;
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ namespace BitTorrent
|
||||
void handleTempPathChanged();
|
||||
void handleCategorySavePathChanged();
|
||||
void handleAppendExtensionToggled();
|
||||
void saveResumeData();
|
||||
void saveResumeData(bool updateStatus = false);
|
||||
|
||||
private:
|
||||
typedef boost::function<void ()> EventTrigger;
|
||||
|
Loading…
x
Reference in New Issue
Block a user