Re: [exim-dev] Numeric overflow in retry logic?

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Michael Haardt
Date:  
À: exim-dev
Sujet: Re: [exim-dev] Numeric overflow in retry logic?
If you were interested in the patch, then try this one. Sorry for
sending the wrong diff. The description still applies.

Michael
----------------------------------------------------------------------
--- src/retry.c.orig    2006-01-02 13:02:35.000000000 +0100
+++ src/retry.c    2006-01-02 14:59:21.000000000 +0100
@@ -746,7 +746,12 @@
             int last_actual_gap = now - retry_record->last_try;
             int lastgap = (last_predicted_gap < last_actual_gap)?
               last_predicted_gap : last_actual_gap;
-            int next_gap = (lastgap * rule->p2)/1000;
+            int next_gap;
+            /* Impose a global retry max */
+            if ((retry_interval_max*1000)/rule->p2>lastgap)
+              next_gap = (lastgap * rule->p2)/1000;
+            else
+              next_gap = retry_interval_max;
             if (rule->rule == 'G')
               {
               next_try = now + ((lastgap < rule->p1)? rule->p1 : next_gap);
@@ -755,16 +760,11 @@
               {
               next_try = now + rule->p1;
               if (next_gap > rule->p1)
-                next_try += random_number(next_gap - rule->p1);
+                next_try += random_number(next_gap - rule->p1)/2 + (next_gap - rule->p1)/2;
               }
             }
           }


-        /* Impose a global retry max */
-
-        if (next_try - now > retry_interval_max)
-          next_try = now + retry_interval_max;
-
         /* If the new message length is greater than the previous one, we
         have to copy the record first. */