summaryrefslogtreecommitdiff
path: root/src/FillRequestGroupCommand.cc
diff options
context:
space:
mode:
authoroliviercommelarbre <oliviercommelarbre@gmail.com>2016-02-11 00:04:49 +0100
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-03-16 21:22:49 +0900
commit9e05371fb6a70d7d5e9d49db31b879e79c1b56e7 (patch)
treede5e25d3a5b89c932f897e6c4905ba7b507337ec /src/FillRequestGroupCommand.cc
parentf0f1b8ef47c391550ff99982f1cad3dd4e1d410d (diff)
Added support for a dynamic management of the number of concurrent downloads as a function of the overall bandwidth observed
Diffstat (limited to 'src/FillRequestGroupCommand.cc')
-rw-r--r--src/FillRequestGroupCommand.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/FillRequestGroupCommand.cc b/src/FillRequestGroupCommand.cc
index 0c326a44..6ec4151b 100644
--- a/src/FillRequestGroupCommand.cc
+++ b/src/FillRequestGroupCommand.cc
@@ -42,6 +42,7 @@
#include "LogFactory.h"
#include "DownloadContext.h"
#include "fmt.h"
+#include "wallclock.h"
namespace aria2 {
@@ -80,6 +81,17 @@ bool FillRequestGroupCommand::execute()
}
}
e_->addRoutineCommand(std::unique_ptr<Command>(this));
+
+ // let's make sure we come back here every second or so
+ // if we use the optimize-concurrent-download option
+ if (rgman->getOptimizeConcurrentDownloads()) {
+ const auto& now = global::wallclock();
+ if (std::chrono::duration_cast<std::chrono::seconds>(lastExecTime.difference(now)) >= 1_s) {
+ lastExecTime = now;
+ rgman->requestQueueCheck();
+ }
+ }
+
return false;
}