X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/f19d6a77f60b876e5453614d24886aabdd242ef6..294a80209a0c6ea617a14fb2ae650d4fd329eab5:/apt-pkg/acquire-worker.cc diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 176772dde..d8bdf5699 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -254,8 +255,8 @@ bool pkgAcquire::Worker::RunMessages() ItemDone(); // Change the status so that it can be dequeued - for (pkgAcquire::Queue::QItem::owner_iterator O = Itm->Owners.begin(); O != Itm->Owners.end(); ++O) - (*O)->Status = pkgAcquire::Item::StatIdle; + for (auto const &O: Itm->Owners) + O->Status = pkgAcquire::Item::StatIdle; // Mark the item as done (taking care of all queues) // and then put it in the main queue again std::vector const ItmOwners = Itm->Owners; @@ -407,7 +408,13 @@ bool pkgAcquire::Worker::RunMessages() else if (Owner->HashesRequired() == true) consideredOkay = false; else + { consideredOkay = true; + // even if the hashes aren't usable to declare something secure + // we can at least use them to declare it an integrity failure + if (ExpectedHashes.empty() == false && ReceivedHashes != ExpectedHashes && _config->Find("Acquire::ForceHash").empty()) + consideredOkay = false; + } if (consideredOkay == true) consideredOkay = Owner->VerifyDone(Message, Config); @@ -457,15 +464,18 @@ bool pkgAcquire::Worker::RunMessages() OwnerQ->ItemDone(Itm); Itm = NULL; + bool errTransient; + { + std::string const failReason = LookupTag(Message, "FailReason"); + std::string const reasons[] = { "Timeout", "ConnectionRefused", + "ConnectionTimedOut", "ResolveFailure", "TmpResolveFailure" }; + errTransient = std::find(std::begin(reasons), std::end(reasons), failReason) != std::end(reasons); + } + for (pkgAcquire::Queue::QItem::owner_iterator O = ItmOwners.begin(); O != ItmOwners.end(); ++O) { - // set some status - if(LookupTag(Message,"FailReason") == "Timeout" || - LookupTag(Message,"FailReason") == "TmpResolveFailure" || - LookupTag(Message,"FailReason") == "ResolveFailure" || - LookupTag(Message,"FailReason") == "ConnectionRefused") + if (errTransient) (*O)->Status = pkgAcquire::Item::StatTransientNetworkError; - (*O)->Failed(Message,Config); if (Log != 0)