pakfire: Prevent an infinite loop with empty server list.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 28 Dec 2013 16:06:38 +0000 (17:06 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 28 Dec 2013 16:06:38 +0000 (17:06 +0100)
src/pakfire/lib/functions.pl

index 133b4950f49a860557f3492edfea7bf5802906fc..d14e0314da05e1a7bfd5377cd7811c1812e22afd 100644 (file)
@@ -305,7 +305,12 @@ sub selectmirror {
                }
        }
        logger("MIRROR INFO: $scount servers found in list");
-       
+
+       if ($scount eq 0) {
+               logger("MIRROR INFO: Could not find any servers. Falling back to main server $Conf::mainserver");
+               return ("HTTP", $Conf::mainserver, "/$Conf::version");
+       }
+
        ### Choose a random server and test if it is online
        #   If the check fails try a new server.
        #   This will never give up.