* Don't throw an exception on 'download->resume_flags() != ~uint32_t()' as there seems to be a race condition where a torrent doing the final hashing might get some flags set. Instead just clear it and hope nothing bad happens. See #1292.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1161 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2010-04-10 07:05:39 +00:00
parent d17fa0c684
commit 856228da3d
+12 -2
View File
@@ -600,8 +600,18 @@ DownloadList::confirm_finished(Download* download) {
rpc::commands.call_catch("event.download.finished", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
if (download->resume_flags() != ~uint32_t())
throw torrent::internal_error("DownloadList::confirm_finished(...) download->resume_flags() != ~uint32_t().");
// if (download->resume_flags() != ~uint32_t())
// throw torrent::internal_error("DownloadList::confirm_finished(...) download->resume_flags() != ~uint32_t().");
// See #1292.
//
// Just reset the value for the moment. If a torrent finishes while
// others are hashing, or some other situtation that causes resume
// flag to change could cause the state to be invalid.
//
// TODO: Add a check when setting the flags to see if the torrent is
// being hashed.
download->set_resume_flags(~uint32_t());
if (!download->is_active() && rpc::call_command_value("d.state", rpc::make_target(download)) == 1)
resume(download, torrent::Download::start_no_create | torrent::Download::start_skip_tracker | torrent::Download::start_keep_baseline);