From c957d1b4d18ca581aa9b40191d2c20136a468b37 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Mon, 3 Jul 2006 00:18:48 +0000 Subject: [PATCH] * Properly invalidate BlockTransfer's in Block so they get deleted. * Added is_active flag to TrackerManager and don't reset the up/download baseline in Download::start() when a request is queued. * Remove the "started" filter in hashing view, so it starts hashing stopped torrents. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@735 e378c898-3ddf-0310-93e7-cc216c733640 --- src/core/download_list.cc | 14 ++++++++++---- src/main.cc | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/core/download_list.cc b/src/core/download_list.cc index 4db22365..31448cfe 100644 --- a/src/core/download_list.cc +++ b/src/core/download_list.cc @@ -328,7 +328,12 @@ DownloadList::pause(Download* download) { // Always clear hashing on pause. When a hashing request is added, // it should have cleared the hash resume data. - download->variable()->set_value("hashing", Download::variable_hashing_stopped); + if (download->variable()->get_value("hashing") != Download::variable_hashing_stopped) { + download->download()->hash_stop(); + download->variable()->set_value("hashing", Download::variable_hashing_stopped); + + std::for_each(slot_map_hash_removed().begin(), slot_map_hash_removed().end(), download_list_call(download)); + } if (!download->download()->is_active()) return; @@ -337,7 +342,6 @@ DownloadList::pause(Download* download) { torrent::resume_save_progress(*download->download(), download->download()->bencode()->get_key("libtorrent_resume")); std::for_each(slot_map_stop().begin(), slot_map_stop().end(), download_list_call(download)); - std::for_each(slot_map_hash_removed().begin(), slot_map_hash_removed().end(), download_list_call(download)); download->variable()->set("state_changed", cachedTime.seconds()); @@ -488,12 +492,14 @@ DownloadList::confirm_finished(Download* download) { control->core()->download_store()->save(download); } + // Send the completed request before resuming so we don't reset the + // up/downloaded baseline. + download->download()->tracker_list().send_completed(); + std::for_each(slot_map_finished().begin(), slot_map_finished().end(), download_list_call(download)); if (!download->is_active() && download->variable()->get_value("state") == 1) resume(download); - - download->download()->tracker_list().send_completed(); } } diff --git a/src/main.cc b/src/main.cc index dfcd657f..f24642e5 100644 --- a/src/main.cc +++ b/src/main.cc @@ -198,7 +198,7 @@ main(int argc, char** argv) { // The hashing view does not include stopped torrents. control->variable()->process_command("view_add = hashing"); - control->variable()->process_command("view_filter = hashing,hashing,started"); + control->variable()->process_command("view_filter = hashing,hashing"); control->variable()->process_command("view_filter_on = hashing,hash_queued,hash_removed,hash_done"); control->variable()->process_command("view_sort_new = hashing,state_changed"); control->variable()->process_command("view_sort_current = hashing,state_changed");