Browse Source

Always save actual queue position

adaptive-webui-19844
Vladimir Golovnev (Glassez) 6 years ago committed by thalieht
parent
commit
386d0565fe
  1. 6
      src/base/bittorrent/session.cpp
  2. 2
      src/base/bittorrent/session.h
  3. 7
      src/base/bittorrent/torrenthandle.cpp
  4. 2
      src/base/bittorrent/torrenthandle.h

6
src/base/bittorrent/session.cpp

@ -2360,7 +2360,7 @@ void Session::generateResumeData(bool final) @@ -2360,7 +2360,7 @@ void Session::generateResumeData(bool final)
if (!final && !torrent->needSaveResumeData()) continue;
if (torrent->hasMissingFiles() || torrent->hasError()) continue;
saveTorrentResumeData(torrent, final);
saveTorrentResumeData(torrent);
}
}
@ -3531,10 +3531,10 @@ void Session::handleTorrentShareLimitChanged(TorrentHandle *const torrent) @@ -3531,10 +3531,10 @@ void Session::handleTorrentShareLimitChanged(TorrentHandle *const torrent)
updateSeedingLimitTimer();
}
void Session::saveTorrentResumeData(TorrentHandle *const torrent, bool finalSave)
void Session::saveTorrentResumeData(TorrentHandle *const torrent)
{
qDebug("Saving fastresume data for %s", qUtf8Printable(torrent->name()));
torrent->saveResumeData(finalSave);
torrent->saveResumeData();
++m_numResumeData;
}

2
src/base/bittorrent/session.h

@ -606,7 +606,7 @@ namespace BitTorrent @@ -606,7 +606,7 @@ namespace BitTorrent
void updateSeedingLimitTimer();
void exportTorrentFile(TorrentHandle *const torrent, TorrentExportFolder folder = TorrentExportFolder::Regular);
void saveTorrentResumeData(TorrentHandle *const torrent, bool finalSave = false);
void saveTorrentResumeData(TorrentHandle *const torrent);
void handleAlert(libtorrent::alert *a);
void dispatchTorrentAlert(libtorrent::alert *a);

7
src/base/bittorrent/torrenthandle.cpp

@ -504,11 +504,8 @@ bool TorrentHandle::needSaveResumeData() const @@ -504,11 +504,8 @@ bool TorrentHandle::needSaveResumeData() const
return m_nativeHandle.need_save_resume_data();
}
void TorrentHandle::saveResumeData(bool updateStatus)
void TorrentHandle::saveResumeData()
{
if (updateStatus) // to update queue_position, see discussion in PR #6154
this->updateStatus();
m_nativeHandle.save_resume_data();
}
@ -1646,7 +1643,7 @@ void TorrentHandle::handleSaveResumeDataAlert(const libtorrent::save_resume_data @@ -1646,7 +1643,7 @@ void TorrentHandle::handleSaveResumeDataAlert(const libtorrent::save_resume_data
resumeData["qBt-name"] = m_name.toStdString();
resumeData["qBt-seedStatus"] = m_hasSeedStatus;
resumeData["qBt-tempPathDisabled"] = m_tempPathDisabled;
resumeData["qBt-queuePosition"] = queuePosition();
resumeData["qBt-queuePosition"] = (nativeHandle().queue_position() + 1); // qBt starts queue at 1
resumeData["qBt-hasRootFolder"] = m_hasRootFolder;
m_session->handleTorrentResumeDataReady(this, resumeData);

2
src/base/bittorrent/torrenthandle.h

@ -372,7 +372,7 @@ namespace BitTorrent @@ -372,7 +372,7 @@ namespace BitTorrent
void handleTempPathChanged();
void handleCategorySavePathChanged();
void handleAppendExtensionToggled();
void saveResumeData(bool updateStatus = false);
void saveResumeData();
/**
* @brief fraction of file pieces that are available at least from one peer

Loading…
Cancel
Save