Explicitly set "added time" when adding new torrent

Don't overwrite "added time" with possibly incorrect value.
Explicitly set "added time" when adding new torrent.

PR #15644.
This commit is contained in:
Vladimir Golovnev 2021-10-31 12:08:19 +03:00 committed by GitHub
parent 8a44c1f6d5
commit cc61ad01b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -31,6 +31,7 @@
#include <algorithm>
#include <cstdint>
#include <ctime>
#include <queue>
#include <string>
#include <utility>
@ -2196,6 +2197,8 @@ bool Session::addTorrent_impl(const std::variant<MagnetUri, TorrentInfo> &source
else
p.flags |= lt::torrent_flags::auto_managed;
p.added_time = std::time(nullptr);
if (!isFindingIncompleteFiles)
return loadTorrent(loadTorrentParams);

View file

@ -1804,8 +1804,6 @@ void TorrentImpl::prepareResumeData(const lt::add_torrent_params &params)
m_ltAddTorrentParams = params;
}
m_ltAddTorrentParams.added_time = addedTime().toSecsSinceEpoch();
// We shouldn't save upload_mode flag to allow torrent operate normally on next run
m_ltAddTorrentParams.flags &= ~lt::torrent_flags::upload_mode;