Change "metadata received" stop condition behavior

PR #20283.
Closes #20122.
This commit is contained in:
Vladimir Golovnev 2024-01-19 20:34:40 +03:00 committed by GitHub
parent 05572a7317
commit 8ec3db1807
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 37 additions and 29 deletions

View file

@ -2749,6 +2749,14 @@ bool SessionImpl::addTorrent_impl(const TorrentDescriptor &source, const AddTorr
if (hasMetadata)
{
// Torrent that is being added with metadata is considered to be added as stopped
// if "metadata received" stop condition is set for it.
if (loadTorrentParams.stopCondition == Torrent::StopCondition::MetadataReceived)
{
loadTorrentParams.stopped = true;
loadTorrentParams.stopCondition = Torrent::StopCondition::None;
}
const TorrentInfo &torrentInfo = *source.info();
Q_ASSERT(addTorrentParams.filePaths.isEmpty() || (addTorrentParams.filePaths.size() == torrentInfo.filesCount()));