[exim-dev] [Bug 1426] smtp_ratelimit_rcpt with factor less t…

Top Page
Delete this message
Reply to this message
Author: Git Commit
Date:  
To: exim-dev
Old-Topics: [exim-dev] [Bug 1426] New: smtp_ratelimit_rcpt with factor less than 1.0
Subject: [exim-dev] [Bug 1426] smtp_ratelimit_rcpt with factor less than 1.0
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1426




--- Comment #6 from Git Commit <git@???> 2014-08-11 19:17:15 ---
Git commit:
http://git.exim.org/exim.git/commitdiff/0f8ba377cb458ec0c5de18a450189e701f710a1e

commit 0f8ba377cb458ec0c5de18a450189e701f710a1e
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Tue May 27 21:50:41 2014 +0100
Commit:     Jeremy Harris <jgh146exb@???>
CommitDate: Tue Jul 22 23:06:15 2014 +0100


    Do not sleep for tiny periods, or hang trying to sleep for zero. Bug 1426
---
 src/src/exim.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)


diff --git a/src/src/exim.c b/src/src/exim.c
index 6a23364..51daa55 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -267,6 +267,10 @@ will wait for ever, so we panic in this instance. (There
was a case of this
when a bug in a function that calls milliwait() caused it to pass invalid
data.
That's when I added the check. :-)

+We assume it to be not worth sleeping for under 100us; this value will
+require revisiting as hardware advances.  This avoids the issue of
+a zero-valued timer setting meaning "never fire".
+
 Argument:  an itimerval structure containing the interval
 Returns:   nothing
 */
@@ -276,6 +280,9 @@ milliwait(struct itimerval *itval)
 {
 sigset_t sigmask;
 sigset_t old_sigmask;
+
+if (itval->it_value.tv_usec < 100 && itval->it_value.tv_sec == 0)
+  return;
 (void)sigemptyset(&sigmask);                           /* Empty mask */
 (void)sigaddset(&sigmask, SIGALRM);                    /* Add SIGALRM */
 (void)sigprocmask(SIG_BLOCK, &sigmask, &old_sigmask);  /* Block SIGALRM */
@@ -310,8 +317,7 @@ struct itimerval itval;
 itval.it_interval.tv_sec = 0;
 itval.it_interval.tv_usec = 0;
 itval.it_value.tv_sec = msec/1000;
-if ((itval.it_value.tv_usec = (msec % 1000) * 1000) == 0)
-  itval.it_value.tv_usec = 1;
+itval.it_value.tv_usec = (msec % 1000) * 1000;
 milliwait(&itval);
 }




--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email