summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/src/deliver.c24
-rw-r--r--src/src/structs.h3
-rw-r--r--src/src/transport.c12
-rw-r--r--src/src/transports/smtp.c41
4 files changed, 42 insertions, 38 deletions
diff --git a/src/src/deliver.c b/src/src/deliver.c
index 33c8b85ae..81df0e083 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/deliver.c,v 1.36 2006/09/18 14:49:23 ph10 Exp $ */
+/* $Cambridge: exim/src/src/deliver.c,v 1.37 2006/10/30 16:41:04 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -5503,19 +5503,29 @@ while (addr_new != NULL) /* Loop until all addresses dealt with */
(void)post_process_one(addr, DEFER, LOG_MAIN, DTYPE_ROUTER, 0);
}
- /* If queue_running, defer routing unless no retry data or we've
- passed the next retry time, or this message is forced. However,
- if the retry time has expired, allow the routing attempt.
- If it fails again, the address will be failed. This ensures that
+ /* If we are in a queue run, defer routing unless there is no retry data or
+ we've passed the next retry time, or this message is forced. In other
+ words, ignore retry data when not in a queue run.
+
+ However, if the domain retry time has expired, always allow the routing
+ attempt. If it fails again, the address will be failed. This ensures that
each address is routed at least once, even after long-term routing
failures.
If there is an address retry, check that too; just wait for the next
retry time. This helps with the case when the temporary error on the
address was really message-specific rather than address specific, since
- it allows other messages through. */
+ it allows other messages through.
+
+ We also wait for the next retry time if this is a message sent down an
+ existing SMTP connection (even though that will be forced). Otherwise there
+ will be far too many attempts for an address that gets a 4xx error. In
+ fact, after such an error, we should not get here because, the host should
+ not be remembered as one this message needs. However, there was a bug that
+ used to cause this to happen, so it is best to be on the safe side. */
- else if (!deliver_force && queue_running &&
+ else if (((queue_running && !deliver_force) || continue_hostname != NULL)
+ &&
((domain_retry_record != NULL &&
now < domain_retry_record->next_try &&
!domain_retry_record->expired)
diff --git a/src/src/structs.h b/src/src/structs.h
index d160aee4a..d64ef51fb 100644
--- a/src/src/structs.h
+++ b/src/src/structs.h
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/structs.h,v 1.13 2006/10/16 15:44:36 ph10 Exp $ */
+/* $Cambridge: exim/src/src/structs.h,v 1.14 2006/10/30 16:41:04 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -67,7 +67,6 @@ typedef struct host_item {
int status; /* Usable, unusable, or unknown */
int why; /* Why host is unusable */
int last_try; /* Time of last try if known */
- BOOL update_waiting; /* Turned off if wait db not to be updated */
} host_item;
/* Chain of rewrite rules, read from the rewrite config, or parsed from the
diff --git a/src/src/transport.c b/src/src/transport.c
index dfcd1d451..e6ad3c0c4 100644
--- a/src/src/transport.c
+++ b/src/src/transport.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/transport.c,v 1.15 2006/02/07 11:19:00 ph10 Exp $ */
+/* $Cambridge: exim/src/src/transport.c,v 1.16 2006/10/30 16:41:04 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -1389,8 +1389,7 @@ better.
Old records should eventually get swept up by the exim_tidydb utility.
Arguments:
- hostlist list of hosts that this message could be sent to;
- the update_waiting flag is set if a host is to be noted
+ hostlist list of hosts that this message could be sent to
tpname name of the transport
Returns: nothing
@@ -1412,8 +1411,7 @@ dbm_file = dbfn_open(buffer, O_RDWR, &dbblock, TRUE);
if (dbm_file == NULL) return;
/* Scan the list of hosts for which this message is waiting, and ensure
-that the message id is in each host record for those that have the
-update_waiting flag set. */
+that the message id is in each host record. */
for (host = hostlist; host!= NULL; host = host->next)
{
@@ -1422,10 +1420,6 @@ for (host = hostlist; host!= NULL; host = host->next)
uschar *s;
int i, host_length;
- /* Skip if the update_waiting flag is not set. */
-
- if (!host->update_waiting) continue;
-
/* Skip if this is the same host as we just processed; otherwise remember
the name for next time. */
diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c
index 55f13d6a3..ac013470b 100644
--- a/src/src/transports/smtp.c
+++ b/src/src/transports/smtp.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/transports/smtp.c,v 1.27 2006/10/09 14:36:25 ph10 Exp $ */
+/* $Cambridge: exim/src/src/transports/smtp.c,v 1.28 2006/10/30 16:41:04 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -193,6 +193,7 @@ smtp_transport_options_block smtp_transport_option_defaults = {
static uschar *smtp_command; /* Points to last cmd for error messages */
static uschar *mail_command; /* Points to MAIL cmd for error messages */
+static BOOL update_waiting; /* TRUE to update the "wait" database */
/*************************************************
@@ -652,7 +653,7 @@ while (count-- > 0)
transport_rcpt_address(addr, include_affixes));
set_errno(addrlist, save_errno, message, DEFER, FALSE);
retry_add_item(addr, addr->address_retry_key, 0);
- host->update_waiting = FALSE;
+ update_waiting = FALSE;
return -1;
}
@@ -699,10 +700,10 @@ while (count-- > 0)
if (host->next != NULL) log_write(0, LOG_MAIN, "%s", addr->message);
- /* Do not put this message on the list of those waiting for this host,
- as otherwise it is likely to be tried too often. */
+ /* Do not put this message on the list of those waiting for specific
+ hosts, as otherwise it is likely to be tried too often. */
- host->update_waiting = FALSE;
+ update_waiting = FALSE;
/* Add a retry item for the address so that it doesn't get tried
again too soon. */
@@ -2102,6 +2103,13 @@ DEBUG(D_transport)
continue_hostname, continue_host_address);
}
+/* Set the flag requesting that these hosts be added to the waiting
+database if the delivery fails temporarily or if we are running with
+queue_smtp or a 2-stage queue run. This gets unset for certain
+kinds of error, typically those that are specific to the message. */
+
+update_waiting = TRUE;
+
/* If a host list is not defined for the addresses - they must all have the
same one in order to be passed to a single transport - or if the transport has
a host list with hosts_override set, use the host list supplied with the
@@ -2288,13 +2296,6 @@ for (cutoff_retry = 0; expired &&
nexthost = host->next;
- /* Set the flag requesting that this host be added to the waiting
- database if the delivery fails temporarily or if we are running with
- queue_smtp or a 2-stage queue run. This gets unset for certain
- kinds of error, typically those that are specific to the message. */
-
- host->update_waiting = TRUE;
-
/* If the address hasn't yet been obtained from the host name, look it up
now, unless the host is already marked as unusable. If it is marked as
unusable, it means that the router was unable to find its IP address (in
@@ -2504,9 +2505,9 @@ for (cutoff_retry = 0; expired &&
/* If there was a retry message key, implying that previously there
was a message-specific defer, we don't want to update the list of
- messages waiting for this host. */
+ messages waiting for these hosts. */
- if (retry_message_key != NULL) host->update_waiting = FALSE;
+ if (retry_message_key != NULL) update_waiting = FALSE;
continue; /* With the next host or IP address */
}
}
@@ -2738,7 +2739,7 @@ for (cutoff_retry = 0; expired &&
to the retry chain. Note that if there was a message defer but now there is
a host defer, the message defer record gets deleted. That seems perfectly
reasonable. Also, stop the message from being remembered as waiting
- for this host. */
+ for specific hosts. */
if (message_defer || retry_message_key != NULL)
{
@@ -2752,7 +2753,7 @@ for (cutoff_retry = 0; expired &&
}
retry_add_item(addrlist, retry_message_key,
rf_message | rf_host | delete_flag);
- host->update_waiting = FALSE;
+ update_waiting = FALSE;
}
/* Any return other than DEFER (that is, OK or ERROR) means that the
@@ -2931,11 +2932,11 @@ for (addr = addrlist; addr != NULL; addr = addr->next)
}
/* Update the database which keeps information about which messages are waiting
-for which hosts to become available. Each host in the list has a flag which is
-set if the data is to be updated. For some message-specific errors, the flag is
-turned off because we don't want follow-on deliveries in those cases. */
+for which hosts to become available. For some message-specific errors, the
+update_waiting flag is turned off because we don't want follow-on deliveries in
+those cases. */
-transport_update_waiting(hostlist, tblock->name);
+if (update_waiting) transport_update_waiting(hostlist, tblock->name);
END_TRANSPORT: