Bläddra i källkod

a bit more robustification

David Rose 13 år sedan
förälder
incheckning
5de361dfd4
2 ändrade filer med 11 tillägg och 12 borttagningar
  1. 0 12
      direct/src/plugin/p3dHost.cxx
  2. 11 0
      direct/src/plugin/p3dPackage.cxx

+ 0 - 12
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;
 }
 

+ 11 - 0
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();