|
@@ -125,20 +125,25 @@ bool MirrorMethod::Clean(string Dir)
|
|
|
|
|
|
|
|
bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str)
|
|
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
|
|
// not that great to use pkgAcquire here, but we do not have
|
|
|
// any other way right now
|
|
// any other way right now
|
|
|
string fetch = BaseUri;
|
|
string fetch = BaseUri;
|
|
|
fetch.replace(0,strlen("mirror://"),"http://");
|
|
fetch.replace(0,strlen("mirror://"),"http://");
|
|
|
|
|
|
|
|
|
|
+ if(Debug)
|
|
|
|
|
+ clog << "MirrorMethod::DownloadMirrorFile(): '" << fetch << "'"
|
|
|
|
|
+ << " to " << MirrorFile << endl;
|
|
|
|
|
+
|
|
|
pkgAcquire Fetcher;
|
|
pkgAcquire Fetcher;
|
|
|
new pkgAcqFile(&Fetcher, fetch, "", 0, "", "", "", MirrorFile);
|
|
new pkgAcqFile(&Fetcher, fetch, "", 0, "", "", "", MirrorFile);
|
|
|
bool res = (Fetcher.Run() == pkgAcquire::Continue);
|
|
bool res = (Fetcher.Run() == pkgAcquire::Continue);
|
|
|
if(res)
|
|
if(res)
|
|
|
DownloadedMirrorFile = true;
|
|
DownloadedMirrorFile = true;
|
|
|
Fetcher.Shutdown();
|
|
Fetcher.Shutdown();
|
|
|
|
|
+
|
|
|
|
|
+ if(Debug)
|
|
|
|
|
+ clog << "MirrorMethod::DownloadMirrorFile() success: " << res << endl;
|
|
|
|
|
+
|
|
|
return res;
|
|
return res;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -176,7 +181,7 @@ bool MirrorMethod::TryNextMirror()
|
|
|
continue;
|
|
continue;
|
|
|
|
|
|
|
|
vector<string>::const_iterator nextmirror = mirror + 1;
|
|
vector<string>::const_iterator nextmirror = mirror + 1;
|
|
|
- if (nextmirror != AllMirrors.end())
|
|
|
|
|
|
|
+ if (nextmirror == AllMirrors.end())
|
|
|
break;
|
|
break;
|
|
|
Queue->Uri.replace(0, mirror->length(), *nextmirror);
|
|
Queue->Uri.replace(0, mirror->length(), *nextmirror);
|
|
|
if (Debug)
|
|
if (Debug)
|