From 2c145fa57c0cca8fcdb20ec2bdd13f4f1c98b414 Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Tue, 4 Jun 2019 06:53:17 +0300 Subject: [PATCH 1/3] Fix incorrectly set torrent startup flag --- src/base/bittorrent/session.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index dc9d41937..b9c2025a6 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -1865,7 +1865,7 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne #if (LIBTORRENT_VERSION_NUM < 10200) handle.auto_managed(false); #else - handle.set_flags(lt::torrent_flags::auto_managed); + handle.unset_flags(lt::torrent_flags::auto_managed); #endif handle.pause(); } From 4ae4ae3cfc281884570e83637f69266156c484e4 Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Tue, 4 Jun 2019 06:55:45 +0300 Subject: [PATCH 2/3] Fix wrong indentation --- src/base/bittorrent/session.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index b9c2025a6..d18f2dd0e 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -1959,7 +1959,7 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne #else p.flags &= ~lt::torrent_flags::seed_mode; #endif -} + } if (!fromMagnetUri) { if (params.restored) { From b644d6685f5ac8c4d4bcba332d4104e4f6a7f158 Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Tue, 4 Jun 2019 07:14:21 +0300 Subject: [PATCH 3/3] Disable "Upload mode" when start preloaded torrent --- src/base/bittorrent/session.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index d18f2dd0e..54aecbb17 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -1862,10 +1862,13 @@ bool Session::addTorrent_impl(CreateTorrentParams params, const MagnetUri &magne --m_extraLimit; try { + // Preloaded torrent is in "Upload mode" so we need to disable it + // otherwise the torrent never be downloaded (until application restart) #if (LIBTORRENT_VERSION_NUM < 10200) handle.auto_managed(false); + handle.set_upload_mode(false); #else - handle.unset_flags(lt::torrent_flags::auto_managed); + handle.unset_flags(lt::torrent_flags::auto_managed | lt::torrent_flags::upload_mode); #endif handle.pause(); }