summaryrefslogtreecommitdiff
path: root/src/RequestGroupMan.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-03-16 21:26:15 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-03-16 21:26:15 +0900
commit1d9a4a8aec2483b112f4b8ec6d8f3d2f527c05ff (patch)
tree42b368c158a1574202de9a28efa53e497b159c49 /src/RequestGroupMan.h
parentf0f1b8ef47c391550ff99982f1cad3dd4e1d410d (diff)
parent60d0cb0e24974534c10f63cf6833119b6af7be2b (diff)
Merge branch 'oliviercommelarbre-optimize-concurrent-downloads'
Diffstat (limited to 'src/RequestGroupMan.h')
-rw-r--r--src/RequestGroupMan.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/RequestGroupMan.h b/src/RequestGroupMan.h
index ec728d49..566b77d3 100644
--- a/src/RequestGroupMan.h
+++ b/src/RequestGroupMan.h
@@ -72,7 +72,13 @@ private:
RequestGroupList reservedGroups_;
DownloadResultList downloadResults_;
- int maxSimultaneousDownloads_;
+ int maxConcurrentDownloads_;
+
+ bool optimizeConcurrentDownloads_;
+ double optimizeConcurrentDownloadsCoeffA_;
+ double optimizeConcurrentDownloadsCoeffB_;
+ int optimizationSpeed_;
+ Timer optimizationSpeedTimer_;
// The number of simultaneous active downloads, excluding seed only
// item if PREF_BT_DETACH_SEED_ONLY is true. We rely on this
@@ -135,9 +141,11 @@ private:
void addRequestGroupIndex(
const std::vector<std::shared_ptr<RequestGroup>>& groups);
+ int optimizeConcurrentDownloads();
+
public:
RequestGroupMan(std::vector<std::shared_ptr<RequestGroup>> requestGroups,
- int maxSimultaneousDownloads, const Option* option);
+ int maxConcurrentDownloads, const Option* option);
~RequestGroupMan();
@@ -195,6 +203,13 @@ public:
bool removeReservedGroup(a2_gid_t gid);
+ bool getOptimizeConcurrentDownloads() const
+ {
+ return optimizeConcurrentDownloads_;
+ }
+
+ bool setupOptimizeConcurrentDownloads();
+
void showDownloadResults(OutputFile& o, bool full) const;
bool isSameFileBeingDownloaded(RequestGroup* requestGroup) const;
@@ -291,7 +306,7 @@ public:
return maxOverallUploadSpeedLimit_;
}
- void setMaxSimultaneousDownloads(int max) { maxSimultaneousDownloads_ = max; }
+ void setMaxConcurrentDownloads(int max) { maxConcurrentDownloads_ = max; }
// Call this function if requestGroups_ queue should be maintained.
// This function is added to reduce the call of maintenance, but at