From: Jay Freeman (saurik) Date: Wed, 30 Nov 2016 08:51:55 +0000 (-0800) Subject: For speed, you *need* multiple downloads per host. X-Git-Tag: cydia_1.1.28%b1~4 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/70aa55819c08ec979f50400d159daadbfb5c7f54 For speed, you *need* multiple downloads per host. --- 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 indexmap; + static indexmap indices; + + pair 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();