summaryrefslogtreecommitdiff
path: root/src/FillRequestGroupCommand.cc
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/FillRequestGroupCommand.cc
parentf0f1b8ef47c391550ff99982f1cad3dd4e1d410d (diff)
parent60d0cb0e24974534c10f63cf6833119b6af7be2b (diff)
Merge branch 'oliviercommelarbre-optimize-concurrent-downloads'
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;
}