summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire.cc
diff options
context:
space:
mode:
authorSam Bingner <sam@bingner.com>2018-12-26 13:07:23 -1000
committerSam Bingner <sam@bingner.com>2018-12-26 14:51:59 -1000
commit59c3e0b998fd69532159d8dc416109cf50651482 (patch)
tree2e58bef1273e4d3542c168980e4a2d793e170045 /apt-pkg/acquire.cc
parentac0d26d4e39da16bdbf575637fd3d4b24a7fb4b8 (diff)
parent2aa218273eb6009880e987f90d3e24b8efb04642 (diff)
Merge nitotv apt fixes into 1.4.81.4.8+nitotv
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 b62c50c00..3f7f2bbf0 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -435,6 +435,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();