fix 'Couldn't find package blah in contents.xml' problem

This commit is contained in:
David Rose 2009-10-25 00:34:27 +00:00
parent 2173055841
commit 1e0cf1664a

View File

@ -331,7 +331,9 @@ contents_file_download_finished(bool success) {
// Access: Private
// Description: Starts a new download attempt of contents.xml, to
// check to see whether our local copy is stale. This
// is called only from Download::download_finished().
// is called only from download_desc_file(), or from
// Download::download_finished(). If the former, the
// download pointer will be NULL.
//
// If it turns out a new version can be downloaded, the
// indicated Download object (and the current install
@ -403,20 +405,30 @@ contents_file_redownload_finished(bool success) {
delete _temp_contents_file;
_temp_contents_file = NULL;
assert(_saved_download != NULL);
if (contents_changed) {
// OK, the contents.xml has changed; this means we have to restart
// the whole download process from the beginning.
nout << "Redownloading contents.xml made a difference.\n";
set_saved_download(NULL);
host_got_contents_file();
} else {
// Nothing's changed. This was just a useless diversion. We now
// return you to our regularly scheduled download.
nout << "Redownloading contents.xml didn't help.\n";
Download *download = _saved_download;
_saved_download = NULL;
download->resume_download_finished(false);
unref_delete(download);
if (download == NULL) {
// But, if _saved_download was NULL (meaning NULL was passed to
// redownload_contents_file(), above), it means that we were
// called from download_desc_file(), and there's nothing more to
// do. We're just hosed.
report_done(false);
} else {
download->resume_download_finished(false);
unref_delete(download);
}
}
}
@ -485,7 +497,7 @@ download_desc_file() {
_package_name, _package_version)) {
nout << "Couldn't find package " << _package_fullname
<< " in contents file.\n";
report_done(false);
redownload_contents_file(NULL);
return;
}