diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 738b4953b..9ca4f1160 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -2357,13 +2357,13 @@ void Bittorrent::addConsoleMessage(QString msg, QString) { } else if (fastresume_rejected_alert* p = dynamic_cast(a.get())) { QTorrentHandle h(p->handle); - if(h.is_valid() && TorrentPersistentData::isSeed(h.hash())){ + if(h.is_valid()) { qDebug("/!\\ Fast resume failed for %s, reason: %s", qPrintable(h.name()), p->message().c_str()); #if LIBTORRENT_VERSION_MINOR < 15 QString msg = QString::fromLocal8Bit(p->message().c_str()); - if(msg.contains("filesize", Qt::CaseInsensitive) && msg.contains("mismatch", Qt::CaseInsensitive)) { + if(msg.contains("filesize", Qt::CaseInsensitive) && msg.contains("mismatch", Qt::CaseInsensitive) && TorrentPersistentData::isSeed(h.hash()) && h.has_missing_files()) { #else - if(p->error.value() == 134) { + if(p->error.value() == 134 && TorrentPersistentData::isSeed(h.hash()) && h.has_missing_files()) { #endif const QString hash = h.hash(); // Mismatching file size (files were probably moved diff --git a/src/qtorrenthandle.cpp b/src/qtorrenthandle.cpp index 9f11a285b..682131206 100644 --- a/src/qtorrenthandle.cpp +++ b/src/qtorrenthandle.cpp @@ -387,6 +387,14 @@ QStringList QTorrentHandle::files_path() const { return res; } +bool QTorrentHandle::has_missing_files() const { + const QStringList paths = files_path(); + foreach(const QString &path, paths) { + if(!QFile::exists(path)) return true; + } + return false; +} + int QTorrentHandle::queue_position() const { Q_ASSERT(h.is_valid()); if(h.queue_position() < 0) diff --git a/src/qtorrenthandle.h b/src/qtorrenthandle.h index fea8e7e1e..ed640a6ea 100644 --- a/src/qtorrenthandle.h +++ b/src/qtorrenthandle.h @@ -110,6 +110,7 @@ class QTorrentHandle { size_type all_time_download() const; size_type total_done() const; QStringList files_path() const; + bool has_missing_files() const; int num_uploads() const; bool is_seed() const; bool is_checking() const;