[exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog exim…

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Tony Finch
日付:  
To: exim-cvs
題目: [exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog exim/exim-src/src acl.c exim/exim-src/util ratelimit.pl
fanf2 2005/09/13 19:06:31 BST

  Modified files:
    exim-doc/doc-txt     ChangeLog 
    exim-src/src         acl.c 
    exim-src/util        ratelimit.pl 
  Log:
  Fix the handling of reverse time in the ratelimit code.


  Revision  Changes    Path
  1.231     +3 -0      exim/exim-doc/doc-txt/ChangeLog
  1.48      +6 -6      exim/exim-src/src/acl.c
  1.2       +1 -1      exim/exim-src/util/ratelimit.pl


  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
  retrieving revision 1.230
  retrieving revision 1.231
  diff -u -u -r1.230 -r1.231
  --- ChangeLog    13 Sep 2005 17:51:05 -0000    1.230
  +++ ChangeLog    13 Sep 2005 18:06:30 -0000    1.231
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.230 2005/09/13 17:51:05 fanf2 Exp $
  +$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.231 2005/09/13 18:06:30 fanf2 Exp $


   Change log file for Exim from version 4.21
   -------------------------------------------
  @@ -189,6 +189,9 @@
         Thus, both old and new test suites can be run.


   TF/02 Added util/ratelimit.pl
  +
  +TF/03 Minor fix to the ratelimit code to improve its behaviour in case the
  +      clock is set back in time.



Exim version 4.52

  Index: acl.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/acl.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -u -r1.47 -r1.48
  --- acl.c    12 Sep 2005 10:08:54 -0000    1.47
  +++ acl.c    13 Sep 2005 18:06:30 -0000    1.48
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/acl.c,v 1.47 2005/09/12 10:08:54 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/acl.c,v 1.48 2005/09/13 18:06:30 fanf2 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -2164,16 +2164,16 @@
                      + (double)tv.tv_usec / 1000000.0;
     double prev_time = (double)dbd->time_stamp
                      + (double)dbd->time_usec / 1000000.0;
  -  double interval = this_time - prev_time;
  -
  -  double i_over_p = interval / period;
  -  double a = exp(-i_over_p);


     /* We must avoid division by zero, and deal gracefully with the clock going
     backwards. If we blunder ahead when time is in reverse then the computed
  -  rate will become bogusly huge. Clamp i/p to a very small number instead. */
  +  rate will be bogus. To be safe we clamp interval to a very small number. */


  -  if (i_over_p <= 0.0) i_over_p = 1e-9;
  +  double interval = this_time - prev_time <= 0.0 ? 1e-9
  +                  : this_time - prev_time;
  +
  +  double i_over_p = interval / period;
  +  double a = exp(-i_over_p);


     dbd->time_stamp = tv.tv_sec;
     dbd->time_usec = tv.tv_usec;


  Index: ratelimit.pl
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/util/ratelimit.pl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- ratelimit.pl    13 Sep 2005 17:51:06 -0000    1.1
  +++ ratelimit.pl    13 Sep 2005 18:06:31 -0000    1.2
  @@ -1,6 +1,6 @@
   #!/usr/bin/perl -wT
   #
  -# $Cambridge: exim/exim-src/util/ratelimit.pl,v 1.1 2005/09/13 17:51:06 fanf2 Exp $
  +# $Cambridge: exim/exim-src/util/ratelimit.pl,v 1.2 2005/09/13 18:06:31 fanf2 Exp $


use strict;

  @@ -118,9 +118,9 @@
     }
     # 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};