summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorTony Finch <dot@dot.at>2005-09-13 18:06:30 +0000
committerTony Finch <dot@dot.at>2005-09-13 18:06:30 +0000
commite5d5a95f33d73ec3c552c08f29089861335caad5 (patch)
treec8dcd2c4297023200d2acf4d9d7cc1012f102eac /src/util
parent7546de58d97a3a4d36dc27ab4e8764f77dc4f887 (diff)
Fix the handling of reverse time in the ratelimit code.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/ratelimit.pl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/ratelimit.pl b/src/util/ratelimit.pl
index a30cfb60a..bb2abbb5a 100644
--- a/src/util/ratelimit.pl
+++ b/src/util/ratelimit.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl -wT
#
-# $Cambridge: exim/src/util/ratelimit.pl,v 1.1 2005/09/13 17:51:06 fanf2 Exp $
+# $Cambridge: exim/src/util/ratelimit.pl,v 1.2 2005/09/13 18:06:31 fanf2 Exp $
use strict;
@@ -118,9 +118,9 @@ while (<>) {
}
# see acl_ratelimit() for details of the following
my $interval = $time - $time{$key};
+ $interval = 1e-9 if $interval <= 0.0;
my $i_over_p = $interval / $period;
my $a = exp(-$i_over_p);
- $i_over_p = 1e-9 if $i_over_p <= 0.0;
$time{$key} = $time;
$rate{$key} = $size * (1.0 - $a) / $i_over_p + $a * $rate{$key};
$max{$key} = $rate{$key} if $rate{$key} > $max{$key};