summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire.cc
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2016-11-30 00:51:55 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2016-11-30 00:51:55 -0800
commit70aa55819c08ec979f50400d159daadbfb5c7f54 (patch)
treedee93c0c002ce00aaf5515dee38c5f0c6056468d /apt-pkg/acquire.cc
parentf3514c6d0f434e007266988edaed1c3d90c5676b (diff)
For speed, you *need* multiple downloads per host.
Diffstat (limited to 'apt-pkg/acquire.cc')
-rw-r--r--apt-pkg/acquire.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 9ceb507f6..4ccfa2605 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -429,6 +429,24 @@ string pkgAcquire::QueueName(string Uri,MethodConfig const *&Config)
} else
{
FullQueueName = AccessSchema + U.Host;
+
+ int parallel(_config->FindI("Acquire::"+U.Access+"::MaxParallel",8));
+ if (parallel > 0) {
+ typedef map<string, int> indexmap;
+ static indexmap indices;
+
+ pair<indexmap::iterator, bool> cache(indices.insert(indexmap::value_type(FullQueueName, -1)));
+ if (cache.second || cache.first->second == -1) {
+ int &index(indices[U.Access]);
+ if (index >= parallel)
+ index = 0;
+ cache.first->second = index++;
+ }
+
+ ostringstream value;
+ value << U.Access << "::" << cache.first->second;
+ FullQueueName = value.str();
+ }
}
unsigned int Instances = 0, SchemaLength = AccessSchema.length();