From 5450971273f7a5c257b87092318f2b6d868452cd Mon Sep 17 00:00:00 2001 From: rakshasa Date: Sat, 24 Mar 2007 00:22:23 +0000 Subject: [PATCH] * Fixed an incorrect exception check in ResourceManager::receive_upload_unchoke(...). * Allow the client to manually cancel tracker requests so that quick shutdown works correctly after moving the TrackerManager::close() call to DownloadWrapper::~DownloadWrapper(). git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@873 e378c898-3ddf-0310-93e7-cc216c733640 --- src/core/download_list.cc | 11 +++++++++++ src/core/download_list.h | 1 + src/core/manager.cc | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/core/download_list.cc b/src/core/download_list.cc index eab35a58..4965203a 100644 --- a/src/core/download_list.cc +++ b/src/core/download_list.cc @@ -207,6 +207,17 @@ DownloadList::close(Download* download) { } } +void +DownloadList::close_quick(Download* download) { + close(download); + + // Make sure we cancel any tracker requests. This should rather be + // 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(); +} + void DownloadList::close_throw(Download* download) { check_contains(download); diff --git a/src/core/download_list.h b/src/core/download_list.h index 6fc1eb18..6403a772 100644 --- a/src/core/download_list.h +++ b/src/core/download_list.h @@ -92,6 +92,7 @@ public: void open_throw(Download* d); void close(Download* d); + void close_quick(Download* d); void close_throw(Download* d); void start_normal(Download* d); diff --git a/src/core/manager.cc b/src/core/manager.cc index 11a19f16..69b56245 100644 --- a/src/core/manager.cc +++ b/src/core/manager.cc @@ -271,7 +271,7 @@ Manager::shutdown(bool force) { if (!force) std::for_each(m_downloadList->begin(), m_downloadList->end(), std::bind1st(std::mem_fun(&DownloadList::pause), m_downloadList)); else - std::for_each(m_downloadList->begin(), m_downloadList->end(), std::bind1st(std::mem_fun(&DownloadList::close), m_downloadList)); + std::for_each(m_downloadList->begin(), m_downloadList->end(), std::bind1st(std::mem_fun(&DownloadList::close_quick), m_downloadList)); } void