From 8e81d44b3c33ab150791621861fe0d53e069ceaf Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Fri, 17 Feb 2023 07:12:56 +0300 Subject: [PATCH] Update the cached state once recheck is started We have to force update the cached state, otherwise someone will be able to get an incorrect one during the interval until the cached state is updated in a regular way. PR #18579. Closes #18559. --- src/base/bittorrent/torrentimpl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index 67d0dabbe..596b339fc 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -1441,6 +1441,10 @@ void TorrentImpl::forceRecheck() if (!hasMetadata()) return; m_nativeHandle.force_recheck(); + // We have to force update the cached state, otherwise someone will be able to get + // an incorrect one during the interval until the cached state is updated in a regular way. + m_nativeStatus.state = lt::torrent_status::checking_resume_data; + m_hasMissingFiles = false; m_unchecked = false; m_completedFiles.fill(false);