From e32591e7bfa07c5d72688cf37d86df0bea6740f6 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 27 Aug 2018 07:23:03 +0100 Subject: [PATCH] pakfire: Remove mirror health check 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 --- html/cgi-bin/pakfire.cgi | 7 ------- src/pakfire/lib/functions.pl | 36 +++--------------------------------- 2 files changed, 3 insertions(+), 40 deletions(-) diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi index 143f123b7f..90e3423c76 100644 --- a/html/cgi-bin/pakfire.cgi +++ b/html/cgi-bin/pakfire.cgi @@ -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, "" );print "

$Lang::tr{'pagerefresh'}
";&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 <$Lang::tr{'pakfire update daily'} on | off - $Lang::tr{'pakfire health check'} - on | - off $Lang::tr{'pakfire register'} on | off diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl index dd4007a449..8685b3a11e 100644 --- a/src/pakfire/lib/functions.pl +++ b/src/pakfire/lib/functions.pl @@ -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); } } } -- 2.39.5