code review: avoiding `session->onTorrentCompletenessChanged` before verification completion

This commit is contained in:
Cœur 2024-04-27 12:53:54 +08:00
parent 4f7ef4807c
commit 73a20c6cdd
1 changed files with 6 additions and 5 deletions

View File

@ -1767,6 +1767,12 @@ void tr_torrent::recheck_completeness()
bool const recent_change = bytes_downloaded_.during_this_session() != 0U;
bool const was_running = is_running();
if (new_completeness != TR_LEECH && was_running && session->shouldFullyVerifyCompleteTorrents())
{
tr_torrentVerify(this);
return;
}
if (recent_change)
{
tr_logAddTraceTor(
@ -1779,11 +1785,6 @@ void tr_torrent::recheck_completeness()
completeness_ = new_completeness;
if (is_done() && was_running && session->shouldFullyVerifyCompleteTorrents())
{
tr_torrentVerify(this);
}
if (is_done())
{
session->close_torrent_files(id());