From 5de361dfd4a981f5462c425a68a2258244081501 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 1 Oct 2012 22:40:27 +0000 Subject: [PATCH] a bit more robustification --- direct/src/plugin/p3dHost.cxx | 12 ------------ direct/src/plugin/p3dPackage.cxx | 11 +++++++++++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/direct/src/plugin/p3dHost.cxx b/direct/src/plugin/p3dHost.cxx index 83d683a220..924d294f4b 100644 --- a/direct/src/plugin/p3dHost.cxx +++ b/direct/src/plugin/p3dHost.cxx @@ -458,10 +458,7 @@ choose_suitable_platform(string &selected_platform, const string &package_name, const string &package_version, const string &package_platform) { - nout << "choose_suitable_platform(" << package_name << ", " - << package_version << ", " << package_platform << ")\n"; if (_xcontents == NULL) { - nout << " xcontents is null\n"; return false; } @@ -493,7 +490,6 @@ choose_suitable_platform(string &selected_platform, // Here's the matching package definition. selected_platform = platform; per_platform = parse_bool_attrib(xpackage, "per_platform", false); - nout << " found match for " << selected_platform << "\n"; return true; } @@ -504,7 +500,6 @@ choose_suitable_platform(string &selected_platform, // Now, we look for an exact match for the expected platform. xpackage = _xcontents->FirstChildElement("package"); - nout << " scanning, xpackage = " << xpackage << "\n"; while (xpackage != NULL) { const char *name = xpackage->Attribute("name"); const char *platform = xpackage->Attribute("platform"); @@ -515,26 +510,21 @@ choose_suitable_platform(string &selected_platform, if (version == NULL) { version = ""; } - nout << " considering " << name << ", " << platform << ", " << version - << "\n"; if (name != NULL && package_name == name && package_platform == platform && package_version == version) { // Here's the matching package definition. - nout << " match!\n"; selected_platform = platform; per_platform = parse_bool_attrib(xpackage, "per_platform", false); return true; } - nout << " no match.\n"; xpackage = xpackage->NextSiblingElement("package"); } // Look one more time, this time looking for a non-platform-specific // version. - nout << " further scanning\n"; xpackage = _xcontents->FirstChildElement("package"); while (xpackage != NULL) { const char *name = xpackage->Attribute("name"); @@ -552,7 +542,6 @@ choose_suitable_platform(string &selected_platform, package_version == version) { selected_platform = platform; per_platform = parse_bool_attrib(xpackage, "per_platform", false); - nout << " found empty platform\n"; return true; } @@ -560,7 +549,6 @@ choose_suitable_platform(string &selected_platform, } // Couldn't find a suitable platform. - nout << " couldn't find.\n"; return false; } diff --git a/direct/src/plugin/p3dPackage.cxx b/direct/src/plugin/p3dPackage.cxx index bb85878476..bc25791575 100755 --- a/direct/src/plugin/p3dPackage.cxx +++ b/direct/src/plugin/p3dPackage.cxx @@ -1369,6 +1369,17 @@ start_download(P3DPackage::DownloadType dtype, const string &urlbase, } } + if (download->_try_urls.size() == 1) { + // If we only ended up with only one URL on the try list, then try + // it twice, for a bit of redundancy in case there's a random + // network hiccup or something. + + // Save a copy into its own string object first to avoid + // self-dereferencing errors in the push_back() method. + string url = download->_try_urls[0]; + download->_try_urls.push_back(url); + } + // OK, start the download. assert(!download->_try_urls.empty()); url = download->_try_urls.back();