Browse Source

Always save info dict when saving fastresume

Otherwise torrents loaded from fastresume won't have it and needs
to redownload it from elsewhere and slowing down the startup process.
This is also required for the future where we will drop loading the
`info` dict from .torrent files.
adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
4aab44e779
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 5
      src/base/bittorrent/session.cpp
  2. 2
      src/base/bittorrent/torrenthandle.cpp

5
src/base/bittorrent/session.cpp

@ -3661,6 +3661,11 @@ void Session::startUpTorrents() @@ -3661,6 +3661,11 @@ void Session::startUpTorrents()
int resumedTorrentsCount = 0;
const auto startupTorrent = [this, &resumeDataDir, &resumedTorrentsCount](const TorrentResumeData &params)
{
// TODO: Remove loading of .torrent files when starting up existing torrents
// Starting from v4.2.0, the required `info` dict will be stored in fastresume too
// (besides .torrent file), that means we can remove loading of .torrent files in
// a later release, such as v4.3.0.
const QString filePath = resumeDataDir.filePath(QString("%1.torrent").arg(params.hash));
qDebug() << "Starting up torrent" << params.hash << "...";
if (!addTorrent_impl(params.addTorrentData, params.magnetUri, TorrentInfo::loadFromFile(filePath), params.data))

2
src/base/bittorrent/torrenthandle.cpp

@ -552,7 +552,7 @@ bool TorrentHandle::needSaveResumeData() const @@ -552,7 +552,7 @@ bool TorrentHandle::needSaveResumeData() const
void TorrentHandle::saveResumeData()
{
m_nativeHandle.save_resume_data();
m_nativeHandle.save_resume_data(lt::torrent_handle::save_info_dict);
m_session->handleTorrentSaveResumeDataRequested(this);
}

Loading…
Cancel
Save