From fd39efd846fd764aa98d42b6cf560118d7a64614 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sun, 29 Nov 2015 18:40:24 +0200 Subject: [PATCH] Fix cases where the fastresume was wrongly overwritten when in 'Missing Files' status. Closes #3602. --- src/core/bittorrent/session.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/bittorrent/session.cpp b/src/core/bittorrent/session.cpp index 5b75fd176..b9171ca6e 100644 --- a/src/core/bittorrent/session.cpp +++ b/src/core/bittorrent/session.cpp @@ -1701,7 +1701,8 @@ void Session::handleTorrentChecked(TorrentHandle *const torrent) void Session::handleTorrentFinished(TorrentHandle *const torrent) { - saveTorrentResumeData(torrent); + if (!torrent->hasError() && !torrent->hasMissingFiles()) + saveTorrentResumeData(torrent); emit torrentFinished(torrent); qDebug("Checking if the torrent contains torrent files to download"); @@ -2153,9 +2154,12 @@ void Session::handleAddTorrentAlert(libtorrent::add_torrent_alert *p) torrent->resume(); logger->addMessage(tr("'%1' added to download list.", "'torrent name' was added to download list.") .arg(torrent->name())); + + // In case of crash before the scheduled generation + // of the fastresumes. + saveTorrentResumeData(torrent); } - saveTorrentResumeData(torrent); if ((torrent->ratioLimit() >= 0) && !m_bigRatioTimer->isActive()) m_bigRatioTimer->start();