tidying
[exim.git] / src / src / transports / smtp.c
index 85582e7535523f14316e30aeb31ad7477e446caf..af2d40fa060f9108cf25f42b1034876acd88ee63 100644 (file)
@@ -631,11 +631,11 @@ Returns:   nothing
 static void
 write_logs(address_item *addr, host_item *host)
 {
-uschar * message = string_sprintf("H=%s [%s]", host->name, host->address);
+uschar * message = LOGGING(outgoing_port)
+  ? string_sprintf("H=%s [%s]:%d", host->name, host->address,
+                   host->port == PORT_NONE ? 25 : host->port)
+  : string_sprintf("H=%s [%s]", host->name, host->address);
 
-if (LOGGING(outgoing_port))
-  message = string_sprintf("%s:%d", message,
-             host->port == PORT_NONE ? 25 : host->port);
 if (addr->message)
   {
   message = string_sprintf("%s: %s", message, addr->message);
@@ -1574,10 +1574,6 @@ lflags.send_quit = TRUE;
 lflags.setting_up = TRUE;
 lflags.esmtp = TRUE;
 lflags.esmtp_sent = FALSE;
-lflags.pending_MAIL;
-#ifndef DISABLE_PRDR
-lflags.prdr_active;
-#endif
 #ifdef SUPPORT_I18N
 lflags.utf8_needed = FALSE;
 #endif
@@ -1949,12 +1945,9 @@ if (  smtp_peer_options & PEER_OFFERED_TLS
     if (rc != OK)
       {
 # ifdef EXPERIMENTAL_DANE
-      if (rc == DEFER && lflags.dane)
-       {
-       log_write(0, LOG_MAIN,
+      if (lflags.dane) log_write(0, LOG_MAIN,
          "DANE attempt failed; no TLS connection to %s [%s]",
          host->name, host->address);
-       }
 # endif
 
       save_errno = ERRNO_TLSFAILURE;
@@ -3163,6 +3156,12 @@ specified in the transports, and therefore not visible at top level, in which
 case continue_more won't get set. */
 
 HDEBUG(D_transport|D_acl|D_v) debug_printf("  SMTP(close)>>\n");
+if (lflags.send_quit)
+  {
+  shutdown(outblock.sock, SHUT_WR);
+  for (rc = 16; read(inblock.sock, inbuffer, sizeof(inbuffer)) > 0 && rc > 0;)
+    rc--;                              /* drain socket */
+  }
 (void)close(inblock.sock);
 
 #ifndef DISABLE_EVENT