Ensure server tls close alert not delayed
authorJeremy Harris <jgh146exb@wizmail.org>
Tue, 11 Jan 2022 14:50:09 +0000 (14:50 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Tue, 11 Jan 2022 14:50:09 +0000 (14:50 +0000)
src/src/tls-gnu.c
src/src/tls-openssl.c

index 53635acae925ab83c548e3fd87d15ea03d880386..3adadb80bea3d513b3705dc6493df4b58a4f72ed 100644 (file)
@@ -3731,6 +3731,11 @@ if (do_shutdown)
 
   tls_write(ct_ctx, NULL, 0, FALSE);   /* flush write buffer */
 
+#ifdef EXIM_TCP_CORK
+  if (do_shutdown > 1)
+    (void) setsockopt(tlsp->active.sock, IPPROTO_TCP, EXIM_TCP_CORK, US &off, sizeof(off));
+#endif
+
   ALARM(2);
   gnutls_bye(state->session, do_shutdown > 1 ? GNUTLS_SHUT_RDWR : GNUTLS_SHUT_WR);
   ALARM_CLR(0);
index 5130455fe6698f7abaf5d6926d5979293bb9be65..576f62ba6cd1262c72992cbe84c2bba4d60bb253 100644 (file)
@@ -4516,6 +4516,9 @@ if (do_shutdown)
   if (  (rc = SSL_shutdown(*sslp)) == 0        /* send "close notify" alert */
      && do_shutdown > 1)
     {
+#ifdef EXIM_TCP_CORK
+    (void) setsockopt(*fdp, IPPROTO_TCP, EXIM_TCP_CORK, US &off, sizeof(off));
+#endif
     ALARM(2);
     rc = SSL_shutdown(*sslp);          /* wait for response */
     ALARM_CLR(0);