]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
pakfire: Remove mirror health check
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 27 Aug 2018 06:23:03 +0000 (07:23 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 27 Aug 2018 06:23:03 +0000 (07:23 +0100)
This is not really necessary because pakfire will automatically
failover to the next mirror anyways and that a mirror responds
to an ICMP echo request doesn't necessarily mean that it can
deliver the requested file.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/pakfire.cgi
src/pakfire/lib/functions.pl

index 143f123b7f71853905175421fe21c55cb73ea96f..90e3423c762e90f44f2b30ab04a5bbf0e0c0012a 100644 (file)
@@ -43,7 +43,6 @@ $pakfiresettings{'VALID'} = '';
 $pakfiresettings{'INSPAKS'} = '';
 $pakfiresettings{'DELPAKS'} = '';
 $pakfiresettings{'AUTOUPDATE'} = 'off';
-$pakfiresettings{'HEALTHCHECK'} = 'on';
 $pakfiresettings{'UUID'} = 'on';
 
 sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header::closebox();}
@@ -163,9 +162,6 @@ my %checked=();
 $checked{'AUTOUPDATE'}{'off'} = '';
 $checked{'AUTOUPDATE'}{'on'} = '';
 $checked{'AUTOUPDATE'}{$pakfiresettings{'AUTOUPDATE'}} = "checked='checked'";
-$checked{'HEALTHCHECK'}{'off'} = '';
-$checked{'HEALTHCHECK'}{'on'} = '';
-$checked{'HEALTHCHECK'}{$pakfiresettings{'HEALTHCHECK'}} = "checked='checked'";
 $checked{'UUID'}{'off'} = '';
 $checked{'UUID'}{'on'} = '';
 $checked{'UUID'}{$pakfiresettings{'UUID'}} = "checked='checked'";
@@ -292,9 +288,6 @@ print <<END;
                        <tr><td align='left' width='45%'>$Lang::tr{'pakfire update daily'}</td><td width="55%" align="left">
           on <input type='radio' name='AUTOUPDATE' value='on' $checked{'AUTOUPDATE'}{'on'} /> |
           <input type='radio' name='AUTOUPDATE' value='off' $checked{'AUTOUPDATE'}{'off'} /> off </td></tr>
-                       <tr><td align='left' width='45%'>$Lang::tr{'pakfire health check'}</td><td align="left">
-          on <input type='radio' name='HEALTHCHECK' value='on' $checked{'HEALTHCHECK'}{'on'} /> |
-          <input type='radio' name='HEALTHCHECK' value='off' $checked{'HEALTHCHECK'}{'off'} /> off </td></tr>          
                        <tr><td align='left' width='45%'>$Lang::tr{'pakfire register'}</td><td align="left">
           on <input type='radio' name='UUID' value='on' $checked{'UUID'}{'on'} /> |
           <input type='radio' name='UUID' value='off' $checked{'UUID'}{'off'} /> off </td></tr>
index dd4007a449271ad674dc02015b484958353b36e9..8685b3a11efafc60cb0d32ab046d1a556d7b8fc5 100644 (file)
@@ -118,20 +118,6 @@ sub usage {
   exit 1;
 }
 
-sub pinghost {
-       my $host = shift;
-       
-       $p = Net::Ping->new("icmp");
-  if ($p->ping($host)) {
-        logger("PING INFO: $host is alive");
-       return 1;
-  } else {
-               logger("PING INFO: $host is unreachable");
-               return 0;
-       }
-  $p->close();
-}
-
 sub fetchfile {
        my $getfile = shift;
        my $gethost = shift;
@@ -349,10 +335,8 @@ sub selectmirror {
        ### Choose a random server and test if it is online
        #   If the check fails try a new server.
        #   This will never give up.
-       my $found = 0;
        my $servers = 0;
-       my $pingdelay = 1;
-       while ($found == 0) {
+       while (1) {
                $server = int(rand($scount) + 1);
                $servers = 0;
                my ($line, $proto, $path, $host);
@@ -364,22 +348,8 @@ sub selectmirror {
                                $proto = $templine[0];
                                $host = $templine[1];
                                $path = $templine[2];
-                               if ($pakfiresettings{'HEALTHCHECK'} eq "off") {
-                                       logger("PING INFO: Healthcheck is disabled");
-                                       $found = 1;
-                                       return ($proto, $host, $path);
-                               }
-                               elsif (pinghost("$host")) {
-                                       $found = 1;
-                                       return ($proto, $host, $path);
-                               }
-                               if ($found == 0) {
-                                       sleep($pingdelay);
-                                       $pingdelay=$pingdelay*2;
-                                       if ($pingdelay>1200) {
-                                               $pingdelay=1200;
-                                       }
-                               }
+
+                               return ($proto, $host, $path);
                        }
                }
        }