mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Save updated resume data for completed torrents
If fastresume data was rejected we need to save updated resume data after torrent finishes rechecking.
This commit is contained in:
parent
b822d2c380
commit
3d70ebfc46
@ -1796,7 +1796,7 @@ void Session::bottomTorrentsQueuePos(const QStringList &hashes)
|
|||||||
saveTorrentsQueue();
|
saveTorrentsQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::handleTorrentSaveResumeDataRequested(TorrentHandle *const torrent)
|
void Session::handleTorrentSaveResumeDataRequested(const TorrentHandle *torrent)
|
||||||
{
|
{
|
||||||
qDebug("Saving resume data is requested for torrent '%s'...", qUtf8Printable(torrent->name()));
|
qDebug("Saving resume data is requested for torrent '%s'...", qUtf8Printable(torrent->name()));
|
||||||
++m_numResumeData;
|
++m_numResumeData;
|
||||||
|
@ -427,7 +427,7 @@ namespace BitTorrent
|
|||||||
void bottomTorrentsQueuePos(const QStringList &hashes);
|
void bottomTorrentsQueuePos(const QStringList &hashes);
|
||||||
|
|
||||||
// TorrentHandle interface
|
// TorrentHandle interface
|
||||||
void handleTorrentSaveResumeDataRequested(TorrentHandle *const torrent);
|
void handleTorrentSaveResumeDataRequested(const TorrentHandle *torrent);
|
||||||
void handleTorrentShareLimitChanged(TorrentHandle *const torrent);
|
void handleTorrentShareLimitChanged(TorrentHandle *const torrent);
|
||||||
void handleTorrentNameChanged(TorrentHandle *const torrent);
|
void handleTorrentNameChanged(TorrentHandle *const torrent);
|
||||||
void handleTorrentSavePathChanged(TorrentHandle *const torrent);
|
void handleTorrentSavePathChanged(TorrentHandle *const torrent);
|
||||||
|
@ -187,6 +187,7 @@ TorrentHandle::TorrentHandle(Session *session, const lt::torrent_handle &nativeH
|
|||||||
, m_ratioLimit(params.ratioLimit)
|
, m_ratioLimit(params.ratioLimit)
|
||||||
, m_seedingTimeLimit(params.seedingTimeLimit)
|
, m_seedingTimeLimit(params.seedingTimeLimit)
|
||||||
, m_tempPathDisabled(params.disableTempPath)
|
, m_tempPathDisabled(params.disableTempPath)
|
||||||
|
, m_fastresumeDataRejected(false)
|
||||||
, m_hasMissingFiles(false)
|
, m_hasMissingFiles(false)
|
||||||
, m_hasRootFolder(params.hasRootFolder)
|
, m_hasRootFolder(params.hasRootFolder)
|
||||||
, m_needsToSetFirstLastPiecePriority(false)
|
, m_needsToSetFirstLastPiecePriority(false)
|
||||||
@ -1652,6 +1653,8 @@ void TorrentHandle::handleTorrentCheckedAlert(const lt::torrent_checked_alert *p
|
|||||||
else {
|
else {
|
||||||
m_startupState = Started;
|
m_startupState = Started;
|
||||||
m_pauseWhenReady = false;
|
m_pauseWhenReady = false;
|
||||||
|
if (m_fastresumeDataRejected && !m_hasMissingFiles)
|
||||||
|
saveResumeData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1788,6 +1791,8 @@ void TorrentHandle::handleSaveResumeDataFailedAlert(const lt::save_resume_data_f
|
|||||||
|
|
||||||
void TorrentHandle::handleFastResumeRejectedAlert(const lt::fastresume_rejected_alert *p)
|
void TorrentHandle::handleFastResumeRejectedAlert(const lt::fastresume_rejected_alert *p)
|
||||||
{
|
{
|
||||||
|
m_fastresumeDataRejected = true;
|
||||||
|
|
||||||
if (p->error.value() == lt::errors::mismatching_file_size) {
|
if (p->error.value() == lt::errors::mismatching_file_size) {
|
||||||
// Mismatching file size (files were probably moved)
|
// Mismatching file size (files were probably moved)
|
||||||
m_hasMissingFiles = true;
|
m_hasMissingFiles = true;
|
||||||
@ -1795,7 +1800,7 @@ void TorrentHandle::handleFastResumeRejectedAlert(const lt::fastresume_rejected_
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LogMsg(tr("Fast resume data was rejected for torrent '%1'. Reason: %2. Checking again...")
|
LogMsg(tr("Fast resume data was rejected for torrent '%1'. Reason: %2. Checking again...")
|
||||||
.arg(name(), QString::fromStdString(p->message())), Log::CRITICAL);
|
.arg(name(), QString::fromStdString(p->message())), Log::WARNING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,6 +438,7 @@ namespace BitTorrent
|
|||||||
qreal m_ratioLimit;
|
qreal m_ratioLimit;
|
||||||
int m_seedingTimeLimit;
|
int m_seedingTimeLimit;
|
||||||
bool m_tempPathDisabled;
|
bool m_tempPathDisabled;
|
||||||
|
bool m_fastresumeDataRejected;
|
||||||
bool m_hasMissingFiles;
|
bool m_hasMissingFiles;
|
||||||
bool m_hasRootFolder;
|
bool m_hasRootFolder;
|
||||||
bool m_needsToSetFirstLastPiecePriority;
|
bool m_needsToSetFirstLastPiecePriority;
|
||||||
|
Loading…
Reference in New Issue
Block a user