From aaaf5d9a5dc1f768cb4fd790837c42436256ce42 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Tue, 23 May 2006 17:26:38 +0000 Subject: [PATCH] * core::DownloadList::receive_hash_done(...) now handles failed initial hash checks properly, rather than throwing an exception. * Explicitly allocate Bitfield::m_data and dis-associate it from the size. This will allow us to store m_size and m_set without the underlying bitfield. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@700 e378c898-3ddf-0310-93e7-cc216c733640 --- src/core/download_list.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/download_list.cc b/src/core/download_list.cc index 6293419d..83d1cbe1 100644 --- a/src/core/download_list.cc +++ b/src/core/download_list.cc @@ -374,9 +374,16 @@ DownloadList::hash_done(Download* download) { if (!download->is_open()) throw torrent::client_error("DownloadList::hash_done(...) !download->is_open()."); - if (!download->is_hash_checked() || download->is_hash_checking() || download->is_active()) + if (download->is_hash_checking() || download->is_active()) throw torrent::client_error("DownloadList::hash_done(...) download in invalid state."); + if (!download->is_hash_checked()) { + download->set_hash_failed(true); + + std::for_each(slot_map_hash_done().begin(), slot_map_hash_done().end(), download_list_call(download)); + return; + } + // Need to find some sane conditional here. Can we check the total // downloaded to ensure something was transferred, thus we didn't // just hash an already completed torrent with lacking session data?