summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-10-12 16:48:59 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-11-04 18:04:01 +0100
commit9f301e0f2d828d662bd67da2be9d8f227caadd07 (patch)
treea4e8ab5cb64140106fe7353daa05d0f657589723 /apt-pkg
parent14341a7ee1ca3dbcdcdbe10ad19b947ce23d972d (diff)
add ConnectionTimedOut to transient failreasons list
All other reasons from methods/connect.cc were already included. Git-Dch: Ignore
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-worker.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc
index 45ee6dde3..d8bdf5699 100644
--- a/apt-pkg/acquire-worker.cc
+++ b/apt-pkg/acquire-worker.cc
@@ -23,6 +23,7 @@
#include <apt-pkg/strutl.h>
#include <apt-pkg/hashes.h>
+#include <algorithm>
#include <string>
#include <vector>
#include <iostream>
@@ -463,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)