summaryrefslogtreecommitdiff
path: root/systems/texlive/tlnet/tlpkg/TeXLive/TLDownload.pm
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-04-11 03:09:12 +0000
committerNorbert Preining <norbert@preining.info>2020-04-11 03:09:12 +0000
commitc2697fc286a1e2c94fd9968b76be6f4a6d2114cd (patch)
tree1dc2cfb07cb032740483dd8be7c74aff66b70352 /systems/texlive/tlnet/tlpkg/TeXLive/TLDownload.pm
parent25111608e6aa05042b0c6f83009262e1973d7a45 (diff)
CTAN sync 202004110309
Diffstat (limited to 'systems/texlive/tlnet/tlpkg/TeXLive/TLDownload.pm')
-rw-r--r--systems/texlive/tlnet/tlpkg/TeXLive/TLDownload.pm32
1 files changed, 21 insertions, 11 deletions
diff --git a/systems/texlive/tlnet/tlpkg/TeXLive/TLDownload.pm b/systems/texlive/tlnet/tlpkg/TeXLive/TLDownload.pm
index e756914562..3a93fac6f4 100644
--- a/systems/texlive/tlnet/tlpkg/TeXLive/TLDownload.pm
+++ b/systems/texlive/tlnet/tlpkg/TeXLive/TLDownload.pm
@@ -1,4 +1,4 @@
-# $Id: TLDownload.pm 42254 2016-10-11 01:22:02Z preining $
+# $Id: TLDownload.pm 54123 2020-03-06 00:59:56Z preining $
# TeXLive::TLDownload.pm - module for abstracting the download modes
# Copyright 2009-2016 Norbert Preining
# This file is licensed under the GNU General Public License version 2
@@ -9,7 +9,7 @@ package TeXLive::TLDownload;
use TeXLive::TLUtils;
use TeXLive::TLConfig;
-my $svnrev = '$Revision: 42254 $';
+my $svnrev = '$Revision: 54123 $';
my $_modulerevision;
if ($svnrev =~ m/: ([0-9]+) /) {
$_modulerevision = $1;
@@ -20,8 +20,6 @@ sub module_revision {
return $_modulerevision;
}
-my $MAX_ERRORCOUNT = 5;
-
# since Net::HTTP and Net::FTP are shipped by the same packages
# we only test for Net::HTTP, if that fails, let us know ;-)
our $net_lib_avail = 0;
@@ -41,6 +39,18 @@ sub new
{
my $class = shift;
my $self = {};
+ $self->{'initcount'} = 0;
+ bless $self, $class;
+ $self->reinit();
+ return $self;
+}
+
+
+
+
+sub reinit
+{
+ my $self = shift;
my $ua = LWP::UserAgent->new(
agent => "texlive/lwp",
# use LWP::ConnCache, and keep 1 connection open
@@ -51,13 +61,8 @@ sub new
$self->{'ua'} = $ua;
$self->{'enabled'} = 1;
$self->{'errorcount'} = 0;
- bless $self, $class;
- return $self;
+ $self->{'initcout'} += 1;
}
-
-
-
-
sub enabled
{
my $self = shift;
@@ -80,6 +85,11 @@ sub disable
my $self = shift;
$self->{'enabled'} = 0;
}
+sub initcount
+{
+ my $self = shift;
+ return $self->{'initcount'};
+}
sub errorcount
{
my $self = shift;
@@ -110,7 +120,7 @@ sub get_file {
my ($self,$url,$out,$size) = @_;
#
# automatically disable if error count is getting too big
- if ($self->errorcount > $MAX_ERRORCOUNT) {
+ if ($self->errorcount > $TeXLive::TLConfig::MaxLWPErrors) {
$self->disable;
}
# return if disabled