X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/e07f3d5a9ed2870a0e2909cc1e5e55e826086c53..f6877b4806585106a204cddcbc4640fc1d4a93ed:/apt-pkg/acquire.cc?ds=sidebyside diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 2ad6bc47f..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(); @@ -1154,7 +1172,7 @@ APT_PURE unsigned long long pkgAcquire::Queue::QItem::GetMaximumSize() const /*{ return Maximum; } /*}}}*/ -APT_PURE int pkgAcquire::Queue::QItem::GetPriority() const /*{{{*/ +APT_PURE int pkgAcquire::Queue::QItem::GetPriority() const /*{{{*/ { int Priority = 0; for (auto const &O: Owners)