]> git.netwichtig.de Git - user/henk/code/exim.git/blobdiff - src/src/transports/smtp.c
Drain socket to get clean TCP FINs
[user/henk/code/exim.git] / src / src / transports / smtp.c
index 85582e7535523f14316e30aeb31ad7477e446caf..ecdb8bf26764d30c51f824e71a04ef59ef112301 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,7 +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
@@ -3163,6 +3162,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