summaryrefslogtreecommitdiff
path: root/methods/mirror.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-06-02 23:30:01 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2010-06-02 23:30:01 +0200
commit963b16dcebba149ae2c35bd255b34242923fbea0 (patch)
treecca559d95052cb3b05fb2d9cb5b36334e228949a /methods/mirror.cc
parentb86f642111954754dd9932ed2f28a9ea85035e87 (diff)
implement Fail-Ignore bool in FetchItem that tells the method that a failure of this item is ok and does not need to be tried on all mirrors
Diffstat (limited to 'methods/mirror.cc')
-rw-r--r--methods/mirror.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/methods/mirror.cc b/methods/mirror.cc
index cfc155f58..ea0fba438 100644
--- a/methods/mirror.cc
+++ b/methods/mirror.cc
@@ -162,24 +162,26 @@ void MirrorMethod::CurrentQueueUriToMirror()
}
}
_error->Error("Internal error: Failed to convert %s back to %s",
- Queue->Uri, BaseUri);
+ Queue->Uri.c_str(), BaseUri.c_str());
}
bool MirrorMethod::TryNextMirror()
{
- if(Debug)
- cerr << "using mirror: " << Mirror << endl;
-
// find current mirror and select next one
for (int i=0; i < AllMirrors.size()-1; i++)
{
if (Queue->Uri.find(AllMirrors[i]) == 0)
{
Queue->Uri.replace(0, AllMirrors[i].size(), AllMirrors[i+1]);
+ if (Debug)
+ clog << "TryNextMirror: " << Queue->Uri << endl;
return true;
}
}
+ if (Debug)
+ clog << "TryNextMirror could not find another mirror to try" << endl;
+
return false;
}
@@ -307,15 +309,12 @@ bool MirrorMethod::Fetch(FetchItem *Itm)
return false;
}
}
- if(Debug)
- clog << "selected mirror: " << Mirror << endl;
+ if(Itm->Uri.find("mirror://") != string::npos)
+ Itm->Uri.replace(0,BaseUri.size(), Mirror);
- for (FetchItem *I = Queue; I != 0; I = I->Next)
- {
- if(I->Uri.find("mirror://") != string::npos)
- I->Uri.replace(0,BaseUri.size(), Mirror);
- }
+ if(Debug)
+ clog << "Fetch: " << Itm->Uri << endl << endl;
// now run the real fetcher
return HttpMethod::Fetch(Itm);
@@ -324,7 +323,7 @@ bool MirrorMethod::Fetch(FetchItem *Itm)
void MirrorMethod::Fail(string Err,bool Transient)
{
// try the next mirror on fail
- if (TryNextMirror())
+ if (!Queue->FailIgnore && TryNextMirror())
return;
// all mirrors failed, so bail out