소스 검색

fix super-mirror issue

David Rose 16 년 전
부모
커밋
8bcb52efdd
1개의 변경된 파일14개의 추가작업 그리고 5개의 파일을 삭제
  1. 14 5
      direct/src/p3d/AppRunner.py

+ 14 - 5
direct/src/p3d/AppRunner.py

@@ -349,11 +349,20 @@ class AppRunner(DirectObject):
         assert self.http
         assert self.http
 
 
         # It's stale, get a new one.
         # It's stale, get a new one.
-        url = PandaModules.URLSpec(host.hostUrlPrefix + fileSpec.filename)
-        print "Freshening %s" % (url)
-        doc = self.http.getDocument(url)
-        if not doc.isValid():
-            return False
+        doc = None
+        if self.superMirrorUrl:
+            # Use the "super mirror" first.
+            url = PandaModules.URLSpec(self.superMirrorUrl + fileSpec.filename)
+            print "Freshening %s" % (url)
+            doc = self.http.getDocument(url)
+            
+        if not doc or not doc.isValid():
+            # Failing the super mirror, contact the actual host.
+            url = PandaModules.URLSpec(host.hostUrlPrefix + fileSpec.filename)
+            print "Freshening %s" % (url)
+            doc = self.http.getDocument(url)
+            if not doc.isValid():
+                return False
         
         
         file = Filename.temporary('', 'p3d_')
         file = Filename.temporary('', 'p3d_')
         if not doc.downloadToFile(file):
         if not doc.downloadToFile(file):