[yum-commits] plugins/fastestmirror

James Antill james at osuosl.org
Fri Feb 6 22:09:15 UTC 2009


 plugins/fastestmirror/fastestmirror.py |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

New commits:
commit ed9a6cd3221896647ca13d1b92e2523785c0db2b
Author: James Antill <james at and.org>
Date:   Fri Feb 6 17:03:49 2009 -0500

    Fix the way we downgrade ftp mirrors, for hosts which give us both

diff --git a/plugins/fastestmirror/fastestmirror.py b/plugins/fastestmirror/fastestmirror.py
index 0a20349..6295531 100644
--- a/plugins/fastestmirror/fastestmirror.py
+++ b/plugins/fastestmirror/fastestmirror.py
@@ -340,9 +340,14 @@ class FastestMirror:
         response time.
         """
         self._poll_mirrors()
-        mirrors = [(v, k) for k, v in self.results.items()]
+        if not downgrade_ftp:
+            mirrors = [(v, k) for k, v in self.results.items()]
+        else:
+            # False comes before True
+            mirrors = [(k.startswith("ftp"), v, k) for k, v in
+                       self.results.items()]
         mirrors.sort()
-        return [x[1] for x in mirrors]
+        return [x[-1] for x in mirrors]
 
     def _poll_mirrors(self):
         """
@@ -366,10 +371,6 @@ class FastestMirror:
                 mhost = "127.0.0.1"
             else:
                 mhost = host(mirror)
-            if downgrade_ftp and mirror.startswith("ftp:"):
-                # One less than "dead"
-                self._add_result(mirror, mhost, 99999999998)
-                continue
 
             if mhost in timedhosts:
                 result = timedhosts[mhost]


More information about the Yum-commits mailing list