Change PH/12 for 4.50 fixed one bug and introduced another; if a host's
[exim.git] / src / src / transports / smtp.c
index edcdc409d799fe0482ae8059c572d3e23fdf0aec..f53d742e4cc89ca80e21abf7f8a05c1afa72f230 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/transports/smtp.c,v 1.8 2005/03/22 15:45:35 ph10 Exp $ */
+/* $Cambridge: exim/src/src/transports/smtp.c,v 1.10 2005/04/07 10:54:54 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -1020,8 +1020,11 @@ if (tls_offered && !suppress_tls &&
 
     for (addr = addrlist; addr != NULL; addr = addr->next)
       {
-      addr->cipher = tls_cipher;
-      addr->peerdn = tls_peerdn;
+      if (addr->transport_return == PENDING_DEFER)
+        {
+        addr->cipher = tls_cipher;
+        addr->peerdn = tls_peerdn;
+        }
       }
     }
   }
@@ -2172,6 +2175,12 @@ for (cutoff_retry = 0; expired &&
     uschar *retry_message_key = NULL;
     uschar *serialize_key = NULL;
 
+    /* Default next host is next host. :-) But this can vary if the
+    hosts_max_try limit is hit (see below). It may also be reset if a host
+    address is looked up here (in case the host was multihomed). */
+
+    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
@@ -2278,10 +2287,8 @@ for (cutoff_retry = 0; expired &&
       continue;      /* With next host */
       }
 
-    /* The default next host is the next host. :-) But this can vary if the
-    hosts_max_try limit is hit (see below). NOTE: we cannot put this setting
-    earlier than this, because a multihomed host whose addresses are not looked
-    up till just above will add to the host list. */
+    /* Reset the default next host in case a multihomed host whose addresses
+    are not looked up till just above added to the host list. */
 
     nexthost = host->next;