summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLUtils.pm
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2020-03-05 00:31:21 +0000
committerNorbert Preining <preining@logic.at>2020-03-05 00:31:21 +0000
commit8e48dc594ccbdc43d7e4e984a2bdf1627d523bb7 (patch)
tree3e0e2d411181a9f83795b6f9b5982b26554cbbf4 /Master/tlpkg/TeXLive/TLUtils.pm
parenta85d452972af29ed4f50b866a1c6d62d9358d275 (diff)
try reinitializing a broken connection in download_file_lwp
git-svn-id: svn://tug.org/texlive/trunk@54084 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm43
1 files changed, 27 insertions, 16 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index ae4c2c282ef..14de29c8f4c 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -2790,31 +2790,42 @@ sub download_file {
}
}
+
sub _download_file_lwp {
my ($url, $dest) = @_;
- if (defined($::tldownload_server) && $::tldownload_server->enabled) {
- debug("persistent connection set up, trying to get $url (for $dest)\n");
- my $ret = $::tldownload_server->get_file($url, $dest);
- if ($ret) {
- ddebug("downloading file via persistent connection succeeded\n");
- return $ret;
- } else {
- debug("TLUtils::download_file: persistent connection ok,"
- . " but download failed: $url\n");
- debug("TLUtils::download_file: retrying with wget.\n");
+ if (!defined($::tldownload_server)) {
+ ddebug("::tldownload_server not defined\n");
+ return(0);
+ }
+ if (!$::tldownload_server->enabled) {
+ # try to reinitialize a disabled connection
+ # disabling happens after 6 failed download trials
+ # we just re-initialize the connection
+ if (!setup_persistent_downloads()) {
+ # setup failed, give up
+ debug("reinitialization of LWP download failed\n");
+ return(0);
}
+ # we don't need to check for ->enabled, because
+ # setup_persistent_downloads calls TLDownload->new()
+ # which, if it succeeds, automatically set enabled to 1
+ }
+ # we are still here, so try to download
+ debug("persistent connection set up, trying to get $url (for $dest)\n");
+ my $ret = $::tldownload_server->get_file($url, $dest);
+ if ($ret) {
+ ddebug("downloading file via persistent connection succeeded\n");
+ return $ret;
} else {
- if (!defined($::tldownload_server)) {
- ddebug("::tldownload_server not defined\n");
- } else {
- ddebug("::tldownload_server->enabled is not set\n");
- }
- debug("persistent connection not set up\n");
+ debug("TLUtils::download_file: persistent connection ok,"
+ . " but download failed: $url\n");
+ debug("TLUtils::download_file: retrying with other downloaders.\n");
}
# if we are still here, download with LWP didn't succeed.
return(0);
}
+
sub _download_file_program {
my ($url, $dest, $type) = @_;
if (win32()) {