]> git.saurik.com Git - apt.git/commitdiff
add ConnectionTimedOut to transient failreasons list
authorDavid Kalnischkies <david@kalnischkies.de>
Mon, 12 Oct 2015 14:48:59 +0000 (16:48 +0200)
committerDavid Kalnischkies <david@kalnischkies.de>
Wed, 4 Nov 2015 17:04:01 +0000 (18:04 +0100)
All other reasons from methods/connect.cc were already included.

Git-Dch: Ignore

apt-pkg/acquire-worker.cc

index 45ee6dde3eecdf4fb35ecab2c3352e64ff0f8080..d8bdf56990fe8adae190d24cf1a3c4886ea2b243 100644 (file)
@@ -23,6 +23,7 @@
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/hashes.h>
 
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/hashes.h>
 
+#include <algorithm>
 #include <string>
 #include <vector>
 #include <iostream>
 #include <string>
 #include <vector>
 #include <iostream>
@@ -463,15 +464,18 @@ bool pkgAcquire::Worker::RunMessages()
            OwnerQ->ItemDone(Itm);
            Itm = NULL;
 
            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)
            {
            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)->Status = pkgAcquire::Item::StatTransientNetworkError;
-
               (*O)->Failed(Message,Config);
 
               if (Log != 0)
               (*O)->Failed(Message,Config);
 
               if (Log != 0)