diff options
Diffstat (limited to 'apt-pkg/acquire.cc')
-rw-r--r-- | apt-pkg/acquire.cc | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 541785b03..6a6167f3b 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(); @@ -609,7 +627,6 @@ static void CheckDropPrivsMustBeDisabled(pkgAcquire const &Fetcher) struct passwd const * const pw = getpwnam(SandboxUser.c_str()); if (pw == NULL) { - _error->Warning(_("No sandbox user '%s' on the system, can not drop privileges"), SandboxUser.c_str()); _config->Set("APT::Sandbox::User", ""); return; } @@ -1262,7 +1279,7 @@ static struct timeval GetTimevalFromSteadyClock() auto const Time = std::chrono::steady_clock::now().time_since_epoch(); auto const Time_sec = std::chrono::duration_cast<std::chrono::seconds>(Time); auto const Time_usec = std::chrono::duration_cast<std::chrono::microseconds>(Time - Time_sec); - return { Time_sec.count(), Time_usec.count() }; + return { static_cast<time_t>(Time_sec.count()), static_cast<suseconds_t>(Time_usec.count()) }; } bool pkgAcquireStatus::Pulse(pkgAcquire *Owner) { |