From 6a45e9dbd7f8194df56edaad766756b01afcb3ea Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Tue, 1 Oct 2013 00:37:34 +0300 Subject: [PATCH] Don't save resume data when torrent has an error. Prevents removing possibly useful .fastresume file and writing garbage. --- src/qtlibtorrent/qbtsession.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 52d146500..7a2a329f7 100755 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -1616,7 +1616,7 @@ void QBtSession::saveTempFastResumeData() { #if LIBTORRENT_VERSION_NUM >= 001600 if (!h.need_save_resume_data()) continue; #endif - if (h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking) continue; + if (h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking || h.has_error()) continue; qDebug("Saving fastresume data for %s", qPrintable(h.name())); h.save_resume_data(); }catch(std::exception e) {} @@ -1648,7 +1648,7 @@ void QBtSession::saveFastResumeData() { continue; // Actually with should save fast resume data for paused files too //if (h.is_paused()) continue; - if (h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking) continue; + if (h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking || h.has_error()) continue; h.save_resume_data(); ++num_resume_data; } catch(libtorrent::invalid_handle&) {}