From: Peter Pentchev Date: Mon, 28 Jun 2010 14:21:20 +0000 (+0000) Subject: Fix a couple of problems with local deliveries. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e8aebea57ee33d0233fb46956dbecd1fd84e552;p=people%2Fms%2Fdma.git Fix a couple of problems with local deliveries. --- diff --git a/changelog b/changelog index a007473..575bdc1 100644 --- a/changelog +++ b/changelog @@ -69,6 +69,8 @@ dma (0.0.2010.06.17-1) UNRELEASED; urgency=low * Add the 34-manpage-defaults patch to properly document what dma will use as default values if not specified in the config file instead of what the default config file specifies. Closes: #544748 + * Add the 35-delivery-retry patch to try local deliveries a bit more often + and to randomize the delivery timeout to avoid locking issues. -- Peter Pentchev Fri, 25 Jun 2010 12:02:22 +0300 diff --git a/patches/35-delivery-retry.patch b/patches/35-delivery-retry.patch new file mode 100644 index 0000000..fd7bf7e --- /dev/null +++ b/patches/35-delivery-retry.patch @@ -0,0 +1,44 @@ +Description: Randomize the retry timeouts a bit. +Origin: other: http://svn.ringlet.net/svn/ringlet/mail/dma/ +Forwarded: no +Author: Peter Pentchev +Last-Update: 2010-06-28 + +--- a/dma.c ++++ b/dma.c +@@ -276,7 +276,7 @@ + deliver(struct qitem *it) + { + int error; +- unsigned int backoff = MIN_RETRY; ++ unsigned int backoff = it->remote? MIN_RETRY: MIN_RETRY_LOCAL; + const char *errmsg = "unknown bounce reason"; + struct timeval now; + struct stat st; +@@ -313,7 +313,13 @@ + "delay cannot be interrupted"); + sleep(backoff); + signal(SIGALRM, SIG_DFL); +- backoff *= 2; ++ backoff = backoff * 2 + ( ++#ifdef HAVE_RANDOM ++ random() ++#else ++ rand() ++#endif ++ % RETRY_JITTER); + if (backoff > MAX_RETRY) + backoff = MAX_RETRY; + goto retry; +--- a/dma.h ++++ b/dma.h +@@ -48,7 +48,9 @@ + + #define BUF_SIZE 2048 + #define MIN_RETRY 300 /* 5 minutes */ ++#define MIN_RETRY_LOCAL 30 /* 30 seconds */ + #define MAX_RETRY (3*60*60) /* retry at least every 3 hours */ ++#define RETRY_JITTER 10 + #define MAX_TIMEOUT (5*24*60*60) /* give up after 5 days */ + #ifndef PATH_MAX + #define PATH_MAX 1024 /* Max path len */ diff --git a/patches/series b/patches/series index 75f1038..a384032 100644 --- a/patches/series +++ b/patches/series @@ -17,3 +17,4 @@ 32-comment-uncomment.patch 33-opportunistic-tls.patch 34-manpage-defaults.patch +35-delivery-retry.patch