Browse Source

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.
adaptive-webui-19844
Vladimir Golovnev 3 years ago committed by GitHub
parent
commit
cc61ad01b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/base/bittorrent/session.cpp
  2. 2
      src/base/bittorrent/torrentimpl.cpp

3
src/base/bittorrent/session.cpp

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

2
src/base/bittorrent/torrentimpl.cpp

@ -1804,8 +1804,6 @@ void TorrentImpl::prepareResumeData(const lt::add_torrent_params &params)
m_ltAddTorrentParams = 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 // We shouldn't save upload_mode flag to allow torrent operate normally on next run
m_ltAddTorrentParams.flags &= ~lt::torrent_flags::upload_mode; m_ltAddTorrentParams.flags &= ~lt::torrent_flags::upload_mode;

Loading…
Cancel
Save