[exim-cvs] Disable server-side close timing sophistication o…

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] Disable server-side close timing sophistication on MacOS
Gitweb: https://git.exim.org/exim.git/commitdiff/9f84d5d5eb8d2f15f9bef6d4d662a4dc5f17219c
Commit:     9f84d5d5eb8d2f15f9bef6d4d662a4dc5f17219c
Parent:     426abccb20f089343f380b1f5b4cfc0bbcf81d90
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Mon Apr 5 13:41:50 2021 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Mon Apr 5 13:43:28 2021 +0100


    Disable server-side close timing sophistication on MacOS


    Broken-by: 001bf8f587
---
 src/OS/os.h-Darwin |  5 +++++
 src/src/smtp_in.c  | 14 ++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)


diff --git a/src/OS/os.h-Darwin b/src/OS/os.h-Darwin
index 1a557d8..a85e92f 100644
--- a/src/OS/os.h-Darwin
+++ b/src/OS/os.h-Darwin
@@ -56,4 +56,9 @@ in "man 2 getgroups". */
rather than a modified sendto() */
#define EXIM_TFO_CONNECTX

+/* MacOS, at least on the buildfarm animal, does not seem to push out
+the SMTP response to QUIT with our usual handling which is trying to get
+the client to FIN first so that the server does not get the TIME_WAIT */
+#define SERVERSIDE_CLOSE_NOWAIT
+
/* End */
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index 5888b80..2bb15b6 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -3847,9 +3847,18 @@ if (*user_msgp)
else
smtp_printf("221 %s closing connection\r\n", FALSE, smtp_active_hostname);

-#ifndef DISABLE_TLS
+#ifdef SERVERSIDE_CLOSE_NOWAIT
+# ifndef DISABLE_TLS
+tls_close(NULL, TLS_SHUTDOWN_NOWAIT);
+# endif
+
+log_write(L_smtp_connection, LOG_MAIN, "%s closed by QUIT",
+ smtp_get_connection_info());
+#else
+
+# ifndef DISABLE_TLS
tls_close(NULL, TLS_SHUTDOWN_WAIT);
-#endif
+# endif

 log_write(L_smtp_connection, LOG_MAIN, "%s closed by QUIT",
   smtp_get_connection_info());
@@ -3866,6 +3875,7 @@ The socket should become readble (though with no data) */
   FD_SET(fd, &fds);
   (void) select(fd + 1, (SELECT_ARG2_TYPE *)&fds, NULL, NULL, &t_limit);
   }
+#endif    /*!DAEMON_CLOSE_NOWAIT*/
 }