diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-03-11 13:53:50 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-03-11 13:53:50 +0100 |
commit | d6cc7079e895e76ad9d086fcc6a40224dd41bb62 (patch) | |
tree | d830c85393cdd5785b88dee76f77dc21eafa00fc /methods/mirror.cc | |
parent | a3f7fff82e1639e3b703399561285d15a7d7b185 (diff) | |
download | apt-d6cc7079e895e76ad9d086fcc6a40224dd41bb62.tar.gz |
methods/mirror.cc: improve debug output and fix selecting the next mirror
Diffstat (limited to 'methods/mirror.cc')
-rw-r--r-- | methods/mirror.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/methods/mirror.cc b/methods/mirror.cc index e8873d97b..d092cc657 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -125,20 +125,25 @@ bool MirrorMethod::Clean(string Dir) bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str) { - if(Debug) - clog << "MirrorMethod::DownloadMirrorFile(): " << endl; - // not that great to use pkgAcquire here, but we do not have // any other way right now string fetch = BaseUri; fetch.replace(0,strlen("mirror://"),"http://"); + if(Debug) + clog << "MirrorMethod::DownloadMirrorFile(): '" << fetch << "'" + << " to " << MirrorFile << endl; + pkgAcquire Fetcher; new pkgAcqFile(&Fetcher, fetch, "", 0, "", "", "", MirrorFile); bool res = (Fetcher.Run() == pkgAcquire::Continue); if(res) DownloadedMirrorFile = true; Fetcher.Shutdown(); + + if(Debug) + clog << "MirrorMethod::DownloadMirrorFile() success: " << res << endl; + return res; } @@ -176,7 +181,7 @@ bool MirrorMethod::TryNextMirror() continue; vector<string>::const_iterator nextmirror = mirror + 1; - if (nextmirror != AllMirrors.end()) + if (nextmirror == AllMirrors.end()) break; Queue->Uri.replace(0, mirror->length(), *nextmirror); if (Debug) |