mirror of
https://github.com/webmin/webmin.git
synced 2025-08-15 21:20:10 +00:00
Re-try webmin updates fetches 5 times
This commit is contained in:
@ -53,7 +53,7 @@ foreach $url (@urls) {
|
|||||||
$mtemp = &transname($mfile);
|
$mtemp = &transname($mfile);
|
||||||
$progress_callback_url = $u->[2];
|
$progress_callback_url = $u->[2];
|
||||||
$progress_callback_prefix = " " x 10;
|
$progress_callback_prefix = " " x 10;
|
||||||
&http_download($mhost, $mport, $mpage, $mtemp, undef,
|
&retry_http_download($mhost, $mport, $mpage, $mtemp, undef,
|
||||||
\&progress_callback, $mssl,
|
\&progress_callback, $mssl,
|
||||||
$in{'upuser'}, $in{'uppass'});
|
$in{'upuser'}, $in{'uppass'});
|
||||||
$irv = &check_update_signature($mhost, $mport, $mpage,
|
$irv = &check_update_signature($mhost, $mport, $mpage,
|
||||||
|
@ -47,7 +47,7 @@ foreach $url (@urls) {
|
|||||||
&parse_http_url($u->[2], $host, $port, $page, $ssl);
|
&parse_http_url($u->[2], $host, $port, $page, $ssl);
|
||||||
($mfile = $mpage) =~ s/^(.*)\///;
|
($mfile = $mpage) =~ s/^(.*)\///;
|
||||||
$mtemp = &transname($mfile);
|
$mtemp = &transname($mfile);
|
||||||
&http_download($mhost, $mport, $mpage, $mtemp, \$error,
|
&retry_http_download($mhost, $mport, $mpage, $mtemp, \$error,
|
||||||
undef, $mssl,
|
undef, $mssl,
|
||||||
$config{'upuser'}, $config{'uppass'});
|
$config{'upuser'}, $config{'uppass'});
|
||||||
if ($error) {
|
if ($error) {
|
||||||
|
@ -822,7 +822,7 @@ $host || &error($text{'update_eurl'});
|
|||||||
|
|
||||||
# Download the file
|
# Download the file
|
||||||
my $temp = &transname();
|
my $temp = &transname();
|
||||||
&http_download($host, $port, $page, $temp, undef, undef, $ssl, $user, $pass,
|
&retry_http_download($host, $port, $page, $temp, undef, undef, $ssl, $user, $pass,
|
||||||
0, 0, 1);
|
0, 0, 1);
|
||||||
|
|
||||||
# Download the signature, if we can check it
|
# Download the signature, if we can check it
|
||||||
@ -830,7 +830,7 @@ my ($ec, $emsg) = &gnupg_setup();
|
|||||||
if (!$ec && $sigmode) {
|
if (!$ec && $sigmode) {
|
||||||
my $err;
|
my $err;
|
||||||
my $sig;
|
my $sig;
|
||||||
&http_download($host, $port, $page."-sig.asc", \$sig,
|
&retry_http_download($host, $port, $page."-sig.asc", \$sig,
|
||||||
\$err, undef, $ssl, $user, $pass, 0, 0, 1);
|
\$err, undef, $ssl, $user, $pass, 0, 0, 1);
|
||||||
if ($err) {
|
if ($err) {
|
||||||
$sigmode == 2 && &error(&text('update_enosig', $err));
|
$sigmode == 2 && &error(&text('update_enosig', $err));
|
||||||
@ -2112,4 +2112,34 @@ elsif ($lnk =~ /^[^\/ ]+$/) {
|
|||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# retry_http_download(host, port, etc..)
|
||||||
|
# Calls http_download until it succeeds
|
||||||
|
sub retry_http_download
|
||||||
|
{
|
||||||
|
my ($host, $port, $page, $dest, $error, $cbfunc, $ssl, $user, $pass,
|
||||||
|
$timeout, $osdn, $nocache, $headers) = @_;
|
||||||
|
my $tries = 5;
|
||||||
|
my $i = 0;
|
||||||
|
my $tryerror;
|
||||||
|
while($i < $tries) {
|
||||||
|
$tryerror = undef;
|
||||||
|
&http_download($host, $port, $page, $dest, \$tryerror, $cbfunc, $ssl, $user,
|
||||||
|
$pass, $timeout, $osdn, $nocache, $headers);
|
||||||
|
if (!$tryerror) {
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
sleep($i);
|
||||||
|
}
|
||||||
|
if ($tryerror) {
|
||||||
|
# Failed every time
|
||||||
|
if (ref($error)) {
|
||||||
|
$$error = $tryerror;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
&error($tryerror);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
Reference in New Issue
Block a user