From bfd30dcabc8be9fd611f2bb084ab6ee2cdf8e502 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sun, 25 Oct 2015 01:39:40 +0300 Subject: [PATCH] Don't put finished torrents in seed_mode. Seed mode has special function in libtorrent. It is used to skip hash checking when adding a torrent and consider it complete. --- src/core/bittorrent/session.cpp | 3 ++- src/core/bittorrent/torrenthandle.cpp | 3 ++- src/core/bittorrent/torrenthandle.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/bittorrent/session.cpp b/src/core/bittorrent/session.cpp index 51407ded8..9a237666c 100644 --- a/src/core/bittorrent/session.cpp +++ b/src/core/bittorrent/session.cpp @@ -1088,7 +1088,7 @@ bool Session::addTorrent_impl(const AddTorrentData &addData, const MagnetUri &ma // Seeding mode // Skip checking and directly start seeding (new in libtorrent v0.15) - if (addData.hasSeedStatus) + if (addData.skipChecking) p.flags |= libt::add_torrent_params::flag_seed_mode; else p.flags &= ~libt::add_torrent_params::flag_seed_mode; @@ -2363,6 +2363,7 @@ bool loadTorrentResumeData(const QByteArray &data, AddTorrentData &out, MagnetUr { out = AddTorrentData(); out.resumed = true; + out.skipChecking = false; libt::lazy_entry fast; libt::error_code ec; diff --git a/src/core/bittorrent/torrenthandle.cpp b/src/core/bittorrent/torrenthandle.cpp index 2fa9fd0fa..8b7d488b8 100644 --- a/src/core/bittorrent/torrenthandle.cpp +++ b/src/core/bittorrent/torrenthandle.cpp @@ -133,7 +133,8 @@ AddTorrentData::AddTorrentData(const AddTorrentParams &in) , savePath(in.savePath) , disableTempPath(in.disableTempPath) , sequential(in.sequential) - , hasSeedStatus(in.skipChecking) + , hasSeedStatus(false) + , skipChecking(in.skipChecking) , addForced(in.addForced) , addPaused(in.addPaused) , filePriorities(in.filePriorities) diff --git a/src/core/bittorrent/torrenthandle.h b/src/core/bittorrent/torrenthandle.h index 61ba6a695..e35d2522c 100644 --- a/src/core/bittorrent/torrenthandle.h +++ b/src/core/bittorrent/torrenthandle.h @@ -90,6 +90,7 @@ namespace BitTorrent bool disableTempPath; bool sequential; bool hasSeedStatus; + bool skipChecking; TriStateBool addForced; TriStateBool addPaused; // for new torrents