mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Safer error detection
This commit is contained in:
parent
8e1e51d268
commit
d2b41d70c8
@ -2357,13 +2357,13 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
}
|
||||
else if (fastresume_rejected_alert* p = dynamic_cast<fastresume_rejected_alert*>(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
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user