Browse Source

download error - add retry to phase download

Ken Patel 15 years ago
parent
commit
8f827fa336
1 changed files with 6 additions and 0 deletions
  1. 6 0
      direct/src/p3d/PackageInfo.py

+ 6 - 0
direct/src/p3d/PackageInfo.py

@@ -1,5 +1,6 @@
 from pandac.PandaModules import Filename, URLSpec, DocumentSpec, Ramfile, Multifile, Decompressor, EUOk, EUSuccess, VirtualFileSystem, Thread, getModelPath, ExecutionEnvironment, PStatCollector, TiXmlDocument, TiXmlDeclaration, TiXmlElement
 from pandac.PandaModules import Filename, URLSpec, DocumentSpec, Ramfile, Multifile, Decompressor, EUOk, EUSuccess, VirtualFileSystem, Thread, getModelPath, ExecutionEnvironment, PStatCollector, TiXmlDocument, TiXmlDeclaration, TiXmlElement
 from pandac import PandaModules
 from pandac import PandaModules
+from libpandaexpress import ConfigVariableInt
 from direct.p3d.FileSpec import FileSpec
 from direct.p3d.FileSpec import FileSpec
 from direct.p3d.ScanDirectoryNode import ScanDirectoryNode
 from direct.p3d.ScanDirectoryNode import ScanDirectoryNode
 from direct.showbase import VFSImporter
 from direct.showbase import VFSImporter
@@ -499,6 +500,11 @@ class PackageInfo:
             # plan B as the only plan.
             # plan B as the only plan.
             self.installPlans = [planB]
             self.installPlans = [planB]
 
 
+        # In case of unexpected failures on the internet, we will retry 
+        # the full download instead of just giving up.
+        for retry in range(ConfigVariableInt('package-full-dl-retries', 1)):
+            self.installPlans.append(planB[:])
+
         pc.stop()
         pc.stop()
 
 
     def __scanDirectoryRecursively(self, dirname):
     def __scanDirectoryRecursively(self, dirname):