MCPcopy Create free account
hub / github.com/aria2/aria2 / update

Method update

src/DHTTaskExecutor.cc:54–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52DHTTaskExecutor::~DHTTaskExecutor() = default;
53
54void DHTTaskExecutor::update()
55{
56 execTasks_.erase(std::remove_if(execTasks_.begin(), execTasks_.end(),
57 std::mem_fn(&DHTTask::finished)),
58 execTasks_.end());
59 int r;
60 if (static_cast<size_t>(numConcurrent_) > execTasks_.size()) {
61 r = numConcurrent_ - execTasks_.size();
62 }
63 else {
64 r = 0;
65 }
66 while (r && !queue_.empty()) {
67 std::shared_ptr<DHTTask> task = queue_.front();
68 queue_.pop_front();
69 task->startup();
70 if (!task->finished()) {
71 execTasks_.push_back(task);
72 --r;
73 }
74 }
75 A2_LOG_DEBUG(fmt("Executing %u Task(s). Queue has %u task(s).",
76 static_cast<unsigned int>(getExecutingTaskSize()),
77 static_cast<unsigned int>(getQueueSize())));
78}
79
80} // namespace aria2

Callers

nothing calls this directly

Calls 10

fmtFunction · 0.85
eraseMethod · 0.80
push_backMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
pop_frontMethod · 0.45
startupMethod · 0.45
finishedMethod · 0.45

Tested by

no test coverage detected