mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-21 16:46:18 +00:00
Clear a stale hash check message after a complete hash check
This commit is contained in:
@@ -586,6 +586,23 @@ DownloadList::hash_done(Download* download) {
|
||||
if (download->is_done() && download->download()->info()->is_meta_download())
|
||||
return process_meta_download(download);
|
||||
|
||||
constexpr auto completed_unfinished_message =
|
||||
"Download registered as completed, but hash check returned unfinished chunks.";
|
||||
constexpr auto final_bad_chunks_message = "Hash check on download completion found bad chunks.";
|
||||
constexpr auto invalid_hashing_message =
|
||||
"Hash check completed but the \"hashing\" variable is in an invalid state.";
|
||||
|
||||
// A pass that found every chunk retires the diagnoses an earlier pass set
|
||||
// below. Any other message is left alone.
|
||||
if (download->is_done() &&
|
||||
(hashing == Download::variable_hashing_initial ||
|
||||
hashing == Download::variable_hashing_rehash ||
|
||||
hashing == Download::variable_hashing_last) &&
|
||||
(download->message() == completed_unfinished_message ||
|
||||
download->message() == final_bad_chunks_message ||
|
||||
download->message() == invalid_hashing_message))
|
||||
download->set_message("");
|
||||
|
||||
switch (hashing) {
|
||||
case Download::variable_hashing_initial:
|
||||
case Download::variable_hashing_rehash:
|
||||
@@ -595,7 +612,7 @@ DownloadList::hash_done(Download* download) {
|
||||
// f.ex deleted, then we clear the state and complete.
|
||||
if (rpc::call_command_value("d.complete", rpc::make_target(download)) && !download->is_done()) {
|
||||
set_state_stopped(download);
|
||||
download->set_message("Download registered as completed, but hash check returned unfinished chunks.");
|
||||
download->set_message(completed_unfinished_message);
|
||||
}
|
||||
|
||||
// Save resume data so we update time-stamps and priorities if
|
||||
@@ -619,7 +636,7 @@ DownloadList::hash_done(Download* download) {
|
||||
if (download->is_done()) {
|
||||
confirm_finished(download);
|
||||
} else {
|
||||
download->set_message("Hash check on download completion found bad chunks.");
|
||||
download->set_message(final_bad_chunks_message);
|
||||
LT_LOG_DOWNLOAD_EVENTS("hash check on download completion found bad chunks", 0);
|
||||
|
||||
DL_TRIGGER_EVENT(download, "event.download.hash_final_failed");
|
||||
@@ -631,7 +648,7 @@ DownloadList::hash_done(Download* download) {
|
||||
case Download::variable_hashing_stopped:
|
||||
default:
|
||||
// Either an error or someone wrote to the hashing variable...
|
||||
download->set_message("Hash check completed but the \"hashing\" variable is in an invalid state.");
|
||||
download->set_message(invalid_hashing_message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user