SVN: toys/rsget.pl/RSGet/Dispatch.pm
sparky
sparky at pld-linux.org
Tue Oct 27 23:55:28 CET 2009
Author: sparky
Date: Tue Oct 27 23:55:27 2009
New Revision: 10872
Modified:
toys/rsget.pl/RSGet/Dispatch.pm
Log:
- fixed get_slots
- introduced max_slots_check option
Modified: toys/rsget.pl/RSGet/Dispatch.pm
==============================================================================
--- toys/rsget.pl/RSGet/Dispatch.pm (original)
+++ toys/rsget.pl/RSGet/Dispatch.pm Tue Oct 27 23:55:27 2009
@@ -17,6 +17,13 @@
allowed => qr/0*[1-9]\d*/,
dynamic => "NUMBER",
},
+ max_slots_check => {
+ desc => "Number of slots per service (per IP) to use when checking file information.",
+ default => 8,
+ allowed => qr/0*[1-9]\d*/,
+ dynamic => "NUMBER",
+ },
+
);
our %downloading;
@@ -121,18 +128,22 @@
{
my $cmd = shift;
my $suggested = shift;
- my $max = setting( "max_slots" );
- return 1 unless defined $suggested;
+ $suggested = "1" unless defined $suggested;
if ( $cmd eq "check" ) {
- return $max unless defined $suggested and $suggested =~ s/^!//;
- }
- if ( $suggested =~ /^\d+$/ ) {
- return $max if $max < $suggested;
- return 0 | $suggested;
+ my $max = setting( "max_slots_check" );
+ if ( $suggested =~ s/^!(\d+)// ) {
+ return $max < $1 ? $max : $1;
+ }
+ return $max;
+ } else {
+ my $max = setting( "max_slots" );
+ if ( $suggested =~ /^\d+$/ ) {
+ return $max < $suggested ? $max : $suggested;
+ }
+ return $max if lc $suggested eq "max";
+ warn "Invalid slots declaration: $suggested\n" if verbose( 1 );
+ return 1;
}
- return $max if lc $suggested eq "max";
- warn "Invalid slots declaration: $suggested\n" if verbose( 1 );
- return 1;
}
sub run
More information about the pld-cvs-commit
mailing list