git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Applied a patch from the Sieve maintainer to fix a bug in "notify".
[exim.git]
/
src
/
util
/
ratelimit.pl
diff --git
a/src/util/ratelimit.pl
b/src/util/ratelimit.pl
index a30cfb60a36f8ace22d13888d7b354fc8d73754e..7fbf0e3f26c1faa8a8949a8857e896c71a345a9a 100644
(file)
--- a/
src/util/ratelimit.pl
+++ b/
src/util/ratelimit.pl
@@
-1,6
+1,6
@@
#!/usr/bin/perl -wT
#
#!/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.
3 2006/04/12 13:37:29
fanf2 Exp $
use strict;
use strict;
@@
-14,8
+14,8
@@
ACL condition. This is so that you can get an idea of a reasonable
limit setting before you deploy the restrictions.
This script isn't perfectly accurate, because the time stamps in
limit setting before you deploy the restrictions.
This script isn't perfectly accurate, because the time stamps in
-Exim's log files are only accurate to a se
ond whereas internally Exim
-computes sender rates to the accuracy of your computer's clock
+Exim's log files are only accurate to a se
cond whereas internally
+
Exim
computes sender rates to the accuracy of your computer's clock
(typically 10ms).
The log files to be processed can be specified on the command line
(typically 10ms).
The log files to be processed can be specified on the command line
@@
-118,9
+118,9
@@
while (<>) {
}
# see acl_ratelimit() for details of the following
my $interval = $time - $time{$key};
}
# 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);
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};
$time{$key} = $time;
$rate{$key} = $size * (1.0 - $a) / $i_over_p + $a * $rate{$key};
$max{$key} = $rate{$key} if $rate{$key} > $max{$key};