1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-26 22:44:36 +00:00

Preserve "skip hash check" when there is no metadata

When torrent is added without metadata libtorrent doesn't honor "seed mode" and doesn't save it in resume data so when metadata is available torrent will still check file hashes. This patch will add a logic that preserves originally enabled "seed mode" until the metadata is received.
PR #17009.
This commit is contained in:
Vladimir Golovnev 2022-05-10 15:34:38 +03:00 committed by GitHub
parent 338e89176d
commit 5af78ad2cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1793,7 +1793,10 @@ void TorrentImpl::handleSaveResumeDataAlert(const lt::save_resume_data_alert *p)
{
Q_ASSERT(m_indexMap.isEmpty());
const auto isSeedMode = static_cast<bool>(m_ltAddTorrentParams.flags & lt::torrent_flags::seed_mode);
m_ltAddTorrentParams = p->params;
if (isSeedMode)
m_ltAddTorrentParams.flags |= lt::torrent_flags::seed_mode;
m_ltAddTorrentParams.have_pieces.clear();
m_ltAddTorrentParams.verified_pieces.clear();
@ -1852,8 +1855,11 @@ void TorrentImpl::prepareResumeData(const lt::add_torrent_params &params)
}
else
{
const bool preserveSeedMode = (!hasMetadata() && (m_ltAddTorrentParams.flags & lt::torrent_flags::seed_mode));
// Update recent resume data
m_ltAddTorrentParams = params;
if (preserveSeedMode)
m_ltAddTorrentParams.flags |= lt::torrent_flags::seed_mode;
}
// We shouldn't save upload_mode flag to allow torrent operate normally on next run