diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2016-11-30 00:51:55 -0800 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2019-08-17 12:34:41 -1000 |
commit | de45c6206fb76c448698b4c3e200629c639916c3 (patch) | |
tree | 59606250170b7314a27868b49938b035970b5eaa /apt-pkg | |
parent | feb309b5b151378b7be899b66a54db9bcf2ea404 (diff) |
For speed, you *need* multiple downloads per host.
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 541785b03..b0c96f2d7 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -450,6 +450,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(); |