From cc61ad01b602a4325d234c1a9a565fc4a7b01e26 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Sun, 31 Oct 2021 12:08:19 +0300 Subject: [PATCH] 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. --- src/base/bittorrent/session.cpp | 3 +++ src/base/bittorrent/torrentimpl.cpp | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 7bbf3c6af..559d380c1 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -2196,6 +2197,8 @@ bool Session::addTorrent_impl(const std::variant &source else p.flags |= lt::torrent_flags::auto_managed; + p.added_time = std::time(nullptr); + if (!isFindingIncompleteFiles) return loadTorrent(loadTorrentParams); diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index 4ffa3ee0b..ed09d0696 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -1804,8 +1804,6 @@ void TorrentImpl::prepareResumeData(const lt::add_torrent_params ¶ms) 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;