Re: [exim] Re: Exim 4.42 sleeping "forever"

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Philip Hazel
Date:  
À: Alex Kiernan
CC: exim-users
Sujet: Re: [exim] Re: Exim 4.42 sleeping "forever"
On Mon, 4 Oct 2004, Alex Kiernan wrote:

> The box got rebooted, ntpd started, exim started, ntpd delta'd the
> time backwards -178.829209s, exim had already started receiving
> messages, the world got confused.


I believe that the patch below should fix this problem.

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book




*** exim-4.42/src/exim.c    Thu Aug 26 15:09:59 2004
--- exim.c    Mon Oct  4 11:38:32 2004
***************
*** 309,314 ****
--- 309,326 ----
    itval.it_interval.tv_usec = 0;
    itval.it_value.tv_sec = then_tv->tv_sec - now_tv.tv_sec;
    itval.it_value.tv_usec = then_tv->tv_usec + resolution - now_true_usec;
+   
+   /* We know that, overall, "now" is less than or equal to "then". Therefore, a
+   negative value for the microseconds is possible only in the case when "now"
+   is more than a second less than "then". That means that itval.it_value.tv_sec 
+   is greater than zero. The following correction is therefore safe. */
+   
+   if (itval.it_value.tv_usec < 0)
+     {
+     itval.it_value.tv_usec += 1000000;
+     itval.it_value.tv_sec -= 1;  
+     }  
+  
    DEBUG(D_transport|D_receive)
      {
      if (!running_in_test_harness)