- Add torrents in pause before applying settings to avoid race conditions

- Started to work on a new function to delete torrents permanently that is safer. Not used yet because it is buggy : it works only for simple cases and I'm not sure I can do better right now with the info libtorrent is providing.
This commit is contained in:
Christophe Dumez 2007-08-22 18:26:00 +00:00
commit cfacac7dbf
3 changed files with 61 additions and 2 deletions

View file

@ -394,14 +394,14 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) {
QString savePath = getSavePath(hash);
// Adding files to bittorrent session
if(has_filtered_files(hash)) {
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, false);
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, false, true);
int index = fullAllocationModeList.indexOf(hash);
if(index == -1) {
fullAllocationModeList << hash;
}
qDebug("Full allocation mode");
}else{
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, true);
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, true, true);
qDebug("Compact allocation mode");
}
if(!h.is_valid()) {
@ -448,6 +448,8 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) {
qDebug("Incremental download enabled for %s", t.name().c_str());
h.set_sequenced_download_threshold(1);
}
// Start torrent because it was added in paused state
h.resume();
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".finished")) {
finishedTorrents << hash;
}else{