From: Dirk Koopman Date: Sat, 23 May 2020 17:37:49 +0000 (+0100) Subject: limit the no of spots stored for a search X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=dd902a3e23aeb207178d9960f17b757262842ed6;p=spider.git limit the no of spots stored for a search This is to cope with people that suck skimmer spots and end up with 100Mb files to read. But it does rely on the hint getting most of the candidates with not more than 2 false positives. --- diff --git a/perl/DXCron.pm b/perl/DXCron.pm index b0d4b1c6..12192891 100644 --- a/perl/DXCron.pm +++ b/perl/DXCron.pm @@ -71,7 +71,7 @@ sub cread my ($min, $hour, $mday, $month, $wday, $cmd) = /^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.+)$/o; next unless defined $min; my $ref = bless {}; - my $err; + my $err = ''; if (defined $min && defined $hour && defined $cmd) { # it isn't all of them, but should be enough to tell if this is a real line $err .= parse($ref, 'min', $min, 0, 60); diff --git a/perl/DXDebug.pm b/perl/DXDebug.pm index f5c16401..c195fe2d 100644 --- a/perl/DXDebug.pm +++ b/perl/DXDebug.pm @@ -85,7 +85,7 @@ if (!defined $DB::VERSION) { my $_isdbg; # current dbg level we are processing -sub dbg($) +sub dbg { return unless $fp; my $t = time; @@ -93,11 +93,11 @@ sub dbg($) my $r = $_; chomp $r; my @l = split /\n/, $r; - for (@l) { - s/([\x00-\x08\x0B-\x1f\x7f-\xff])/uc sprintf("%%%02x",ord($1))/eg; - print "$_\n" if defined \*STDOUT && !$no_stdout; - my $tag = $_isdbg ? "($_isdbg) " : ''; - my $str = "$t^$tag$_"; + foreach my $l (@l) { + $l =~ s/([\x00-\x08\x0B-\x1f\x7f-\xff])/sprintf("%%%02X",ord($1))/eg; + print "$l\n" if defined \*STDOUT && !$no_stdout; + my $tag = $_isdbg ? "($_isdbg) " : '(*) '; + my $str = "$t^$tag$l"; &$callback($str) if $callback; if ($dbgringlth) { shift @dbgring while (@dbgring > $dbgringlth); diff --git a/perl/DXLogPrint.pm b/perl/DXLogPrint.pm index 9564ae69..9bb51f20 100644 --- a/perl/DXLogPrint.pm +++ b/perl/DXLogPrint.pm @@ -20,6 +20,8 @@ use Julian; our $readback = `which tac`; chomp $readback; +undef $readback; # yet another reason not to use the cloud! + use strict; diff --git a/perl/Msg.pm b/perl/Msg.pm index 9ea2bc10..9b7ce76f 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -484,7 +484,7 @@ sub new_client { $sock->start; $conn->{peerhost} = $handle->peerhost || 'unknown'; $conn->{peerhost} =~ s|^::ffff:||; # chop off leading pseudo IPV6 stuff on dual stack listeners - $conn->{peerport} = $handle->peerport; + $conn->{peerport} = $handle->peerport || 0; dbg((ref $conn) . " accept $conn->{cnum} from $conn->{peerhost}:$conn->{peerport}") if isdbg('conn') || isdbg('connect'); my ($rproc, $eproc) = &{$server_conn->{rproc}} ($conn, $conn->{peerhost}, $conn->{peerport}); $conn->{sort} = 'Incoming'; diff --git a/perl/Spot.pm b/perl/Spot.pm index 74b3f773..840913d1 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -307,6 +307,7 @@ sub search my \@s = split /\\^/; $checkfilter; push \@spots, \\\@s; + shift \@spots if \@spots > $to + 2; } my \$c; my \$ref; diff --git a/perl/cluster.pl b/perl/cluster.pl index 3e57deb6..e13fb034 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -513,8 +513,8 @@ sub setup_start if ($desc) { my ($v, $s, $b, $g) = $desc =~ /^([\d.]+)(?:\.(\d+))?-(\d+)-g([0-9a-f]+)/; $s ||= ''; - dbg("Git: $desc"); - dbg("Git: V=$v S=$s B=$b g=$g"); + dbg("Git: $desc") if isdbg('git'); + dbg("Git: V=$v S=$s B=$b g=$g") if isdbg('git'); $version = $v; $build = $b || 0; $gitversion = "$g\[r]";