mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07:00
Fix bug of torrents don't save "stopped" state
This commit is contained in:
parent
aaeffe3846
commit
5f94238d23
2 changed files with 18 additions and 14 deletions
|
@ -4253,21 +4253,21 @@ bool Session::loadTorrentResumeData(const QByteArray &data, const TorrentInfo &m
|
|||
if (metadata.isValid())
|
||||
p.ti = metadata.nativeInfo();
|
||||
|
||||
torrentParams.paused = (p.flags & lt::torrent_flags::paused) && !(p.flags & lt::torrent_flags::auto_managed);
|
||||
if (!torrentParams.paused)
|
||||
if (p.flags & lt::torrent_flags::stop_when_ready)
|
||||
{
|
||||
// If torrent has "stop_when_ready" flag set then it is actually "stopped"
|
||||
// but temporarily "resumed" to perform some service jobs (e.g. checking)
|
||||
torrentParams.paused = !!(p.flags & lt::torrent_flags::stop_when_ready);
|
||||
torrentParams.paused = true;
|
||||
torrentParams.forced = false;
|
||||
// ...but temporarily "resumed" to perform some service jobs (e.g. checking)
|
||||
p.flags &= ~lt::torrent_flags::paused;
|
||||
p.flags |= lt::torrent_flags::auto_managed;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fix inconsistent state when "paused" torrent has "stop_when_ready" flag set
|
||||
p.flags &= ~lt::torrent_flags::stop_when_ready;
|
||||
torrentParams.paused = (p.flags & lt::torrent_flags::paused) && !(p.flags & lt::torrent_flags::auto_managed);
|
||||
torrentParams.forced = !(p.flags & lt::torrent_flags::paused) && !(p.flags & lt::torrent_flags::auto_managed);
|
||||
}
|
||||
|
||||
torrentParams.forced = !(p.flags & lt::torrent_flags::paused) && !(p.flags & lt::torrent_flags::auto_managed);
|
||||
|
||||
const bool hasMetadata = (p.ti && p.ti->is_valid());
|
||||
if (!hasMetadata && !root.dict_find("info-hash"))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue