From 92b72953030b3e485bcdf270e77dec1d31315445 Mon Sep 17 00:00:00 2001 From: Jari Sundell Date: Mon, 3 Oct 2011 13:20:33 +0900 Subject: [PATCH 1/5] Removing unneeded TODO file. --- TODO | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 TODO diff --git a/TODO b/TODO deleted file mode 100644 index ac8c2c48..00000000 --- a/TODO +++ /dev/null @@ -1,19 +0,0 @@ -See libtorrent/TODO for a list of TODO items. - -Polling during last phase of shutdown should be very quick, don't use -normal timeout. - -Consider basing WindowPeer* on a common base class. - -Some kind of indication that a tracker request was tried, but won't be -allowed since the tracker set a min interval. - -Make accumulate return the value, no refs please... - -> - seeing the number of seeds / leechers of a torrent on the main -> screen (and the level of distribution between leechers); - -> - being able to delete not just the torrent file, but the files it -> created from rtorrent. Like when you start a torrent, but it is too -> slow or broken or for various reasons you don't want to download it. - From aaa55860885e7eb46a9d804a50643bdc33d0097e Mon Sep 17 00:00:00 2001 From: Jari Sundell Date: Mon, 3 Oct 2011 20:25:02 +0900 Subject: [PATCH 2/5] Added '__builtin_popcount' check to 'configure.ac' as 'rak/algorithms.h' needs it. --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index 94dc56b0..5bac9e06 100644 --- a/configure.ac +++ b/configure.ac @@ -48,6 +48,7 @@ AC_DEFINE(USER_AGENT, [std::string(PACKAGE "/" VERSION "/") + torrent::version() AC_CHECK_FUNCS(posix_memalign) TORRENT_CHECK_CACHELINE() +TORRENT_CHECK_POPCOUNT() CC_ATTRIBUTE_UNUSED( AC_DEFINE([__UNUSED], [__attribute__((unused))], [Wrapper around unused attribute]), From fa5224bf7f50ca93f3698c7f2bc7e634d7dccd40 Mon Sep 17 00:00:00 2001 From: Jari Sundell Date: Tue, 4 Oct 2011 22:52:35 +0900 Subject: [PATCH 3/5] Moved the sanity checks for 'd.directory.set' to 'Download::set_root_directory(path)' so that it always gets used. --- src/command_download.cc | 23 ----------------------- src/core/download.cc | 28 +++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/command_download.cc b/src/command_download.cc index d203cf22..93a916a3 100644 --- a/src/command_download.cc +++ b/src/command_download.cc @@ -175,29 +175,6 @@ apply_d_delete_tied(core::Download* download) { void apply_d_directory(core::Download* download, const std::string& name) { - // If the download is open, hashed and has completed chunks make - // sure to verify that the download files are still present. - // - // This should ensure that no one tries to set the destination - // directory 'after' moving files. In cases where the user wants to - // override this behavior the download must first be closed or - // 'd.directory_base.set' may be used. - rak::file_stat file_stat; - torrent::FileList* file_list = download->file_list(); - - if (download->is_hash_checked() && file_list->completed_chunks() != 0 && - - (file_list->is_multi_file() ? - !file_list->is_root_dir_created() : - !file_stat.update(file_list->front()->frozen_path()))) { - - download->set_message("Cannot change the directory of an open download after the files have been moved."); - rpc::call_command("d.state.set", (int64_t)0, rpc::make_target(download)); - control->core()->download_list()->close_directly(download); - - throw torrent::input_error("Cannot change the directory of an open download atter the files have been moved."); - } - if (!download->file_list()->is_multi_file()) download->set_root_directory(name); else if (name.empty() || *name.rbegin() == '/') diff --git a/src/core/download.cc b/src/core/download.cc index bebdaaad..eb1240f4 100644 --- a/src/core/download.cc +++ b/src/core/download.cc @@ -39,8 +39,9 @@ #include #include #include -#include +#include #include +#include #include #include #include @@ -172,10 +173,31 @@ Download::set_throttle_name(const std::string& throttleName) { void Download::set_root_directory(const std::string& path) { - torrent::FileList* fileList = m_download.file_list(); + // If the download is open, hashed and has completed chunks make + // sure to verify that the download files are still present. + // + // This should ensure that no one tries to set the destination + // directory 'after' moving files. In cases where the user wants to + // override this behavior the download must first be closed or + // 'd.directory_base.set' may be used. + rak::file_stat file_stat; + torrent::FileList* file_list = m_download.file_list(); + + if (is_hash_checked() && file_list->completed_chunks() != 0 && + + (file_list->is_multi_file() ? + !file_list->is_root_dir_created() : + !file_stat.update(file_list->front()->frozen_path()))) { + + set_message("Cannot change the directory of an open download after the files have been moved."); + rpc::call_command("d.state.set", (int64_t)0, rpc::make_target(this)); + control->core()->download_list()->close_directly(this); + + throw torrent::input_error("Cannot change the directory of an open download atter the files have been moved."); + } control->core()->download_list()->close_directly(this); - fileList->set_root_dir(rak::path_expand(path)); + file_list->set_root_dir(rak::path_expand(path)); bencode()->get_key("rtorrent").insert_key("directory", path); } From 83e898e0324cefbec31152443808456de666f362 Mon Sep 17 00:00:00 2001 From: Jari Sundell Date: Thu, 6 Oct 2011 23:44:28 +0900 Subject: [PATCH 4/5] Updated to new API. --- src/command_download.cc | 2 +- src/core/download_list.cc | 4 ++-- src/display/window_download_statusbar.cc | 2 +- src/ui/download.cc | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/command_download.cc b/src/command_download.cc index 93a916a3..8d3cce5e 100644 --- a/src/command_download.cc +++ b/src/command_download.cc @@ -797,7 +797,7 @@ initialize_command_download() { CMD2_DL ("d.wanted_chunks", CMD2_ON_DATA(wanted_chunks)); - CMD2_DL_V ("d.tracker_announce", std::bind(&torrent::TrackerList::manual_request, CMD2_BIND_TL, false)); + CMD2_DL_V ("d.tracker_announce", std::bind(&torrent::Download::manual_request, CMD2_BIND_DL, false)); CMD2_DL ("d.tracker_numwant", std::bind(&torrent::TrackerList::numwant, CMD2_BIND_TL)); CMD2_DL_VALUE_V ("d.tracker_numwant.set", std::bind(&torrent::TrackerList::set_numwant, CMD2_BIND_TL, std::placeholders::_2)); CMD2_DL ("d.tracker_focus", std::bind(&torrent::TrackerList::focus_index, CMD2_BIND_TL)); diff --git a/src/core/download_list.cc b/src/core/download_list.cc index cb47b8d3..601effb3 100644 --- a/src/core/download_list.cc +++ b/src/core/download_list.cc @@ -286,7 +286,7 @@ DownloadList::close_quick(Download* download) { // handled by some parameter to the close function, or some other // way of giving the client more control of when STOPPED requests // are sent. - download->download()->tracker_list()->manual_cancel(); + download->download()->manual_cancel(); } void @@ -635,7 +635,7 @@ DownloadList::confirm_finished(Download* download) { // Send the completed request before resuming so we don't reset the // up/downloaded baseline. - download->download()->tracker_list()->send_completed(); + download->download()->send_completed(); // Save the hash in case the finished event erases it. torrent::HashString infohash = download->info()->hash(); diff --git a/src/display/window_download_statusbar.cc b/src/display/window_download_statusbar.cc index c69bc01c..cd94e5af 100644 --- a/src/display/window_download_statusbar.cc +++ b/src/display/window_download_statusbar.cc @@ -91,7 +91,7 @@ WindowDownloadStatusbar::redraw() { position = print_download_status(buffer, last, m_download); m_canvas->print(0, 2, "[%c:%i] %s", m_download->tracker_list()->has_active() ? 'C' : ' ', - (int)(m_download->download()->tracker_list()->time_next_connection()), + (int)(m_download->download()->time_next_connection()), buffer); } diff --git a/src/ui/download.cc b/src/ui/download.cc index a772d26f..3968a249 100644 --- a/src/ui/download.cc +++ b/src/ui/download.cc @@ -391,8 +391,8 @@ Download::bind_keys() { m_bindings['+'] = sigc::mem_fun(this, &Download::receive_next_priority); m_bindings['-'] = sigc::mem_fun(this, &Download::receive_prev_priority); - m_bindings['t'] = sigc::bind(sigc::mem_fun(m_download->tracker_list(), &torrent::TrackerList::manual_request), false); - m_bindings['T'] = sigc::bind(sigc::mem_fun(m_download->tracker_list(), &torrent::TrackerList::manual_request), true); + m_bindings['t'] = sigc::bind(sigc::mem_fun(m_download->download(), &torrent::Download::manual_request), false); + m_bindings['T'] = sigc::bind(sigc::mem_fun(m_download->download(), &torrent::Download::manual_request), true); const char* keys = control->ui()->get_throttle_keys(); From 11c107560b89ef846f7d38ab113acf60be9510ae Mon Sep 17 00:00:00 2001 From: Jari Sundell Date: Fri, 7 Oct 2011 10:53:33 +0900 Subject: [PATCH 5/5] Adding .gitignore file. --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..c97ffecf --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +aclocal.m4 +src/rtorrent +scripts/libtool.m4 +scripts/ltoptions.m4 +scripts/ltsugar.m4 +scripts/ltversion.m4 +scripts/lt~obsolete.m4