* Renamed 't.get_enabled' to 't.is_enabled'.

* The torrent is no longer closed on finished for on_finished
commands, instead d.set_directory causes the download to call
close_directly.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@974 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-09-05 17:52:16 +00:00
parent 48f13fb7a3
commit 3b82216a1b
5 changed files with 40 additions and 28 deletions
+3
View File
@@ -52,6 +52,7 @@
#include "control.h"
#include "download.h"
#include "manager.h"
namespace core {
@@ -158,6 +159,8 @@ void
Download::set_root_directory(const std::string& path) {
torrent::FileList* fileList = m_download.file_list();
control->core()->download_list()->close_directly(this);
if (path.empty()) {
fileList->set_root_dir("./" + (fileList->is_multi_file() ? m_download.name() : std::string()));
+11 -12
View File
@@ -234,6 +234,17 @@ DownloadList::close(Download* download) {
}
}
void
DownloadList::close_directly(Download* download) {
if (download->download()->is_active()) {
download->download()->stop2(torrent::Download::stop_skip_tracker);
torrent::resume_save_progress(*download->download(), download->download()->bencode()->get_key("libtorrent_resume"));
}
if (download->download()->is_open())
download->download()->close();
}
void
DownloadList::close_quick(Download* download) {
close(download);
@@ -582,18 +593,6 @@ DownloadList::confirm_finished(Download* download) {
// up/downloaded baseline.
download->download()->tracker_list().send_completed();
// Close before calling on_finished to ensure the user can do stuff
// like change move the downloaded files and change the directory.
// close_throw(download);
// HACK:
if (download->is_open()) {
pause(download, torrent::Download::stop_skip_tracker);
download->download()->close();
std::for_each(slot_map_hash_removed().begin(), slot_map_hash_removed().end(), download_list_call(download));
std::for_each(slot_map_close().begin(), slot_map_close().end(), download_list_call(download));
}
// END
std::for_each(slot_map_finished().begin(), slot_map_finished().end(), download_list_call(download));
if (download->resume_flags() != ~uint32_t())
+1
View File
@@ -101,6 +101,7 @@ public:
void open_throw(Download* d);
void close(Download* d);
void close_directly(Download* d);
void close_quick(Download* d);
void close_throw(Download* d);