From 9e05371fb6a70d7d5e9d49db31b879e79c1b56e7 Mon Sep 17 00:00:00 2001 From: oliviercommelarbre Date: Thu, 11 Feb 2016 00:04:49 +0100 Subject: Added support for a dynamic management of the number of concurrent downloads as a function of the overall bandwidth observed --- src/FillRequestGroupCommand.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/FillRequestGroupCommand.cc') 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(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(lastExecTime.difference(now)) >= 1_s) { + lastExecTime = now; + rgman->requestQueueCheck(); + } + } + return false; } -- cgit