summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-worker.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-10-26 01:09:48 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2017-12-13 23:56:29 +0100
commitdff555d40bb9776b5b809e06527e46b15e78736c (patch)
tree09afa67a4910dac43f7ce0dc6ae8f96a96d163bd /apt-pkg/acquire-worker.cc
parent47c0bdc310c8cd62374ca6e6bb456dd183bdfc07 (diff)
implement Acquire::Retries support for all items
Moving the Retry-implementation from individual items to the worker implementation not only gives every file retry capability instead of just a selected few but also avoids needing to implement it in each item (incorrectly).
Diffstat (limited to 'apt-pkg/acquire-worker.cc')
-rw-r--r--apt-pkg/acquire-worker.cc34
1 files changed, 25 insertions, 9 deletions
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc
index 39158aed7..a763d9242 100644
--- a/apt-pkg/acquire-worker.cc
+++ b/apt-pkg/acquire-worker.cc
@@ -506,6 +506,9 @@ bool pkgAcquire::Worker::RunMessages()
Itm = nullptr;
bool errTransient = false, errAuthErr = false;
+ if (StringToBool(LookupTag(Message, "Transient-Failure"), false) == true)
+ errTransient = true;
+ else
{
std::string const failReason = LookupTag(Message, "FailReason");
{
@@ -522,15 +525,28 @@ bool pkgAcquire::Worker::RunMessages()
for (auto const Owner: ItmOwners)
{
- if (errAuthErr && Owner->GetExpectedHashes().empty() == false)
- Owner->Status = pkgAcquire::Item::StatAuthError;
- else if (errTransient)
- Owner->Status = pkgAcquire::Item::StatTransientNetworkError;
- auto SavedDesc = Owner->GetItemDesc();
- if (isDoomedItem(Owner) == false)
- Owner->Failed(Message,Config);
- if (Log != nullptr)
- Log->Fail(SavedDesc);
+ if (errTransient == true && Config->LocalOnly == false && Owner->ModifyRetries() != 0)
+ {
+ --Owner->ModifyRetries();
+ Owner->FailMessage(Message);
+ auto SavedDesc = Owner->GetItemDesc();
+ if (Log != nullptr)
+ Log->Fail(SavedDesc);
+ if (isDoomedItem(Owner) == false)
+ OwnerQ->Owner->Enqueue(SavedDesc);
+ }
+ else
+ {
+ if (errAuthErr && Owner->GetExpectedHashes().empty() == false)
+ Owner->Status = pkgAcquire::Item::StatAuthError;
+ else if (errTransient)
+ Owner->Status = pkgAcquire::Item::StatTransientNetworkError;
+ auto SavedDesc = Owner->GetItemDesc();
+ if (isDoomedItem(Owner) == false)
+ Owner->Failed(Message, Config);
+ if (Log != nullptr)
+ Log->Fail(SavedDesc);
+ }
}
ItemDone();