Skip to content

Commit

Permalink
Always save info dict when saving fastresume
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Chocobo1 committed Aug 31, 2019
1 parent d657c87 commit 4aab44e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/base/bittorrent/session.cpp
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/base/bittorrent/torrenthandle.cpp
Expand Up @@ -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);
}

Expand Down

0 comments on commit 4aab44e

Please sign in to comment.