diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2014-10-14 00:13:29 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2014-10-14 00:13:29 +0900 |
| commit | f72a303b8deb702a2ea4f63280302f88741da581 (patch) | |
| tree | 9df1a81101fe93b1eb9b545559f0148dde504591 /src/RequestGroup.cc | |
| parent | 09d79565376c03b3e735793703c1dc185d413c31 (diff) | |
Add --bt-detach-seed-only option
This option excludes seed only downloads when counting concurrent
active downloads (-j option). This means that if -j3 is given and
this option is turned on and 3 downloads are active and one of those
enters seed mode, then it is excluded from active download count (thus
it becomes 2), and the next download waiting in queue gets started.
But be aware that seeding item is still recognized as active download
in RPC method.
Diffstat (limited to 'src/RequestGroup.cc')
| -rw-r--r-- | src/RequestGroup.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/RequestGroup.cc b/src/RequestGroup.cc index e06decdc..d839286e 100644 --- a/src/RequestGroup.cc +++ b/src/RequestGroup.cc @@ -149,7 +149,8 @@ RequestGroup::RequestGroup(const std::shared_ptr<GroupId>& gid, haltRequested_(false), forceHaltRequested_(false), pauseRequested_(false), - inMemoryDownload_(false) + inMemoryDownload_(false), + seedOnly_(false) { fileAllocationEnabled_ = option_->get(PREF_FILE_ALLOCATION) != V_NONE; if(!option_->getAsBool(PREF_DRY_RUN)) { @@ -1265,4 +1266,18 @@ bool RequestGroup::p2pInvolved() const #endif // !ENABLE_BITTORRENT } +void RequestGroup::enableSeedOnly() +{ + if(seedOnly_ || !option_->getAsBool(PREF_BT_DETACH_SEED_ONLY)) { + return; + } + + if(requestGroupMan_) { + seedOnly_ = true; + + requestGroupMan_->decreaseNumActive(); + requestGroupMan_->requestQueueCheck(); + } +} + } // namespace aria2 |
