bug with counting resolved
authorheiko
Wed, 03 Jan 2007 21:21:26 +0000
changeset 36 4c717800f8ef
parent 35 f4701d2fcda7
child 37 85968da03d1f
bug with counting resolved
exigrey.pl
exim-exigrey.pl
--- a/exigrey.pl	Wed Jan 03 17:15:49 2007 +0000
+++ b/exigrey.pl	Wed Jan 03 21:21:26 2007 +0000
@@ -89,7 +89,7 @@
 	    iterate(%h, sub {
 		my ($item, $v0, $v1, $c) = @_;
 		++$seen;
-		++$returned if $c;
+		++$returned if $v0 != $v1;  # soon it can be $c
 		$oldest_c = $v0 if $v0 < $oldest_c;
 		$oldest_u = $v1 if $v1 < $oldest_u;
 	    });
--- a/exim-exigrey.pl	Wed Jan 03 17:15:49 2007 +0000
+++ b/exim-exigrey.pl	Wed Jan 03 21:21:26 2007 +0000
@@ -55,7 +55,8 @@
 		$h{$item} = "$now $now 0\0";
 		$rc = "yes";
 	} else {
-		my ($created, $used, $count) = split " ", $h{$item};
+		($_ = $h{$item}) =~ s/\0*$//;		# we're \0 terminated
+		my ($created, $used, $count) = split;
 		if ($now - $created < $delay) { $rc = "yes" }
 		else { 
 			$rc = "no";