texlive[54084] Master/tlpkg/TeXLive/TLUtils.pm: try reinitializing a
commits+preining at tug.org
commits+preining at tug.org
Thu Mar 5 01:31:21 CET 2020
Revision: 54084
http://tug.org/svn/texlive?view=revision&revision=54084
Author: preining
Date: 2020-03-05 01:31:21 +0100 (Thu, 05 Mar 2020)
Log Message:
-----------
try reinitializing a broken connection in download_file_lwp
Modified Paths:
--------------
trunk/Master/tlpkg/TeXLive/TLUtils.pm
Modified: trunk/Master/tlpkg/TeXLive/TLUtils.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLUtils.pm 2020-03-04 23:30:22 UTC (rev 54083)
+++ trunk/Master/tlpkg/TeXLive/TLUtils.pm 2020-03-05 00:31:21 UTC (rev 54084)
@@ -2790,31 +2790,42 @@
}
}
+
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()) {
More information about the tex-live-commits
mailing list.