summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-03-19 15:42:25 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2009-03-19 15:42:25 +0100
commit5dad4134da37576de12721f34165c1fe4d138b3c (patch)
tree1285f93bae65076be5354131eb6d48e1bb855564 /methods
parent5ef499349c609f5ef50bd633692faa2665f4f96f (diff)
* methods/mirror.cc:
- when download the mirror file and the server is down, return a propper error message (LP: #278635)
Diffstat (limited to 'methods')
-rw-r--r--methods/mirror.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/methods/mirror.cc b/methods/mirror.cc
index bdd783cc7..b3a956b95 100644
--- a/methods/mirror.cc
+++ b/methods/mirror.cc
@@ -123,6 +123,8 @@ bool MirrorMethod::Clean(string Dir)
bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str)
{
+ if(Debug)
+ clog << "MirrorMethod::DownloadMirrorFile(): " << endl;
// check the file, if it is not older than RefreshInterval just use it
// otherwise try to get a new one
@@ -251,6 +253,9 @@ string MirrorMethod::GetMirrorFileName(string mirror_uri_str)
depth. */
bool MirrorMethod::Fetch(FetchItem *Itm)
{
+ if(Debug)
+ clog << "MirrorMethod::Fetch()" << endl;
+
// the http method uses Fetch(0) as a way to update the pipeline,
// just let it do its work in this case - Fetch() with a valid
// Itm will always run before the first Fetch(0)
@@ -269,8 +274,17 @@ bool MirrorMethod::Fetch(FetchItem *Itm)
DownloadMirrorFile(Itm->Uri);
}
- if(Mirror.empty())
- SelectMirror();
+ if(Mirror.empty()) {
+ if(!SelectMirror()) {
+ // no valid mirror selected, something went wrong downloading
+ // from the master mirror site most likely and there is
+ // no old mirror file availalbe
+ return false;
+ }
+ }
+ if(Debug)
+ clog << "selected mirror: " << Mirror << endl;
+
for (FetchItem *I = Queue; I != 0; I = I->Next)
{