diff -urN ../exim-4.95.orig/src/tls-gnu.c ./src/tls-gnu.c --- ../exim-4.95.orig/src/tls-gnu.c 2021-09-28 11:24:46.000000000 +0300 +++ ./src/tls-gnu.c 2022-02-17 13:10:07.845371000 +0200 @@ -3730,6 +3730,11 @@ 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); diff -urN ../exim-4.95.orig/src/tls-openssl.c ./src/tls-openssl.c --- ../exim-4.95.orig/src/tls-openssl.c 2021-09-28 11:24:46.000000000 +0300 +++ ./src/tls-openssl.c 2022-02-17 13:10:16.479271000 +0200 @@ -4393,6 +4393,9 @@ 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);