BUGFIX: Force data recheck whenever a torrent is moved

BUGFIX: Detect existing torrent data even if incomplete torrents are saved to a different folder
This commit is contained in:
Christophe Dumez
2010-01-04 21:29:18 +00:00
parent facbb650d0
commit 89f317dad2
3 changed files with 33 additions and 9 deletions

View File

@@ -1,6 +1,8 @@
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.0.6
- BUGFIX: Fix detection of invalid torrent files
- BUGFIX: Stop catching signals once one has been caught to avoid possible infinite loop
- BUGFIX: Force data recheck whenever a torrent is moved
- BUGFIX: Detect existing torrent data even if incomplete torrents are saved to a different folder
* Web Dec 31 2009 - Christophe Dumez <chris@qbittorrent.org> - v2.0.5
- BUGFIX: Fix crash with downloaded/availability bars when the torrent has too many pieces

View File

@@ -702,11 +702,13 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
}
}
QString savePath = getSavePath(hash);
qDebug("addMagnetURI: using save_path: %s", savePath.toLocal8Bit().data());
if(defaultTempPath.isEmpty() || (resumed && TorrentPersistentData::isSeed(hash))) {
p.save_path = savePath.toLocal8Bit().data();
} else {
if(!defaultTempPath.isEmpty() && resumed && !TorrentPersistentData::isSeed(hash)) {
qDebug("addMagnetURI: Temp folder is enabled.");
p.save_path = defaultTempPath.toLocal8Bit().data();
qDebug("addMagnetURI: using save_path: %s", defaultTempPath.toLocal8Bit().data());
} else {
p.save_path = savePath.toLocal8Bit().data();
qDebug("addMagnetURI: using save_path: %s", savePath.toLocal8Bit().data());
}
// Preallocate all?
if(preAllocateAll)
@@ -730,6 +732,13 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
return h;
}
Q_ASSERT(h.hash() == hash);
// If temp path is enabled, move torrent
if(!defaultTempPath.isEmpty() && !resumed) {
qDebug("Temp folder is enabled, moving new torrent to temp folder");
h.move_storage(defaultTempPath);
}
// Connections limit per torrent
h.set_max_connections(Preferences::getMaxConnecsPerTorrent());
// Uploads limit per torrent
@@ -854,11 +863,13 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
} else {
savePath = getSavePath(hash);
}
qDebug("addTorrent: using save_path: %s", savePath.toLocal8Bit().data());
if(defaultTempPath.isEmpty() || (resumed && TorrentPersistentData::isSeed(hash))) {
p.save_path = savePath.toLocal8Bit().data();
} else {
if(!defaultTempPath.isEmpty() && resumed && !TorrentPersistentData::isSeed(hash)) {
qDebug("addTorrent::Temp folder is enabled.");
p.save_path = defaultTempPath.toLocal8Bit().data();
qDebug("addTorrent: using save_path: %s", defaultTempPath.toLocal8Bit().data());
} else {
p.save_path = savePath.toLocal8Bit().data();
qDebug("addTorrent: using save_path: %s", savePath.toLocal8Bit().data());
}
#ifdef LIBTORRENT_0_15
@@ -899,6 +910,12 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
return h;
}
// If temp path is enabled, move torrent
if(!defaultTempPath.isEmpty() && !resumed) {
qDebug("Temp folder is enabled, moving new torrent to temp folder");
h.move_storage(defaultTempPath);
}
// Connections limit per torrent
h.set_max_connections(Preferences::getMaxConnecsPerTorrent());
// Uploads limit per torrent
@@ -1495,6 +1512,11 @@ void Bittorrent::readAlerts() {
}
}
}
else if (storage_moved_alert* p = dynamic_cast<storage_moved_alert*>(a.get())) {
QTorrentHandle h(p->handle);
if(h.is_valid())
h.force_recheck(); //XXX: Required by libtorrent for now
}
else if (metadata_received_alert* p = dynamic_cast<metadata_received_alert*>(a.get())) {
QTorrentHandle h(p->handle);
if(h.is_valid()) {

View File

@@ -249,7 +249,7 @@ public:
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash();
QHash<QString, QVariant> data = all_data[hash].toHash();
return data["seed"].toBool();
return data.value("seed", false).toBool();
}
static bool isMagnet(QString hash) {