]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/acquire-worker.cc
merge from apt--mvo
[apt.git] / apt-pkg / acquire-worker.cc
index d06024178ef4fe17fe4adf97a7b14a7aa2423579..739c9e32ccacf1e4381e1872b3a3db61c3f3067a 100644 (file)
@@ -12,9 +12,6 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#ifdef __GNUG__
-#pragma implementation "apt-pkg/acquire-worker.h"
-#endif
 #include <apt-pkg/acquire-worker.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/configuration.h>
@@ -270,8 +267,25 @@ bool pkgAcquire::Worker::RunMessages()
               _error->Warning("Bizarre Error - File size is not what the server reported %s %lu",
                               LookupTag(Message,"Size","0").c_str(),TotalSize);
 
+           // see if there is a hash to verify
+           string RecivedHash;
+           HashString expectedHash(Owner->HashSum());
+           if(!expectedHash.empty()) 
+           {
+              string hashTag = expectedHash.HashType()+"-Hash";
+              string hashSum = LookupTag(Message, hashTag.c_str());
+              if(!hashSum.empty())
+                 RecivedHash = expectedHash.HashType() + ":" + hashSum;
+              if(_config->FindB("Debug::pkgAcquire::Auth", false) == true)
+              {
+                 clog << "201 URI Done: " << Owner->DescURI() << endl
+                      << "RecivedHash: " << RecivedHash << endl
+                      << "ExpectedHash: " << expectedHash.toStr() 
+                      << endl << endl;
+              }
+           }
            Owner->Done(Message,atoi(LookupTag(Message,"Size","0").c_str()),
-                       LookupTag(Message,"MD5-Hash"),Config);
+                       RecivedHash.c_str(), Config);
            ItemDone();
            
            // Log that we are done
@@ -307,6 +321,13 @@ bool pkgAcquire::Worker::RunMessages()
            pkgAcquire::Item *Owner = Itm->Owner;
            pkgAcquire::ItemDesc Desc = *Itm;
            OwnerQ->ItemDone(Itm);
+
+           // set some status
+           if(LookupTag(Message,"FailReason") == "Timeout" || 
+              LookupTag(Message,"FailReason") == "TmpResolveFailure" ||
+              LookupTag(Message,"FailReason") == "ConnectionRefused") 
+              Owner->Status = pkgAcquire::Item::StatTransientNetworkError;
+
            Owner->Failed(Message,Config);
            ItemDone();