From 2130e492c2cda886d74abbb77df4493f151e0a44 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sat, 23 Jan 2021 21:28:28 +0000 Subject: [PATCH] Move QUICKACK disable as early as possible in server handling --- src/src/daemon.c | 5 +++++ src/src/smtp_in.c | 9 ++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/src/daemon.c b/src/src/daemon.c index 21807f64f..1006961d3 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -2431,6 +2431,11 @@ for (;;) if (accept_socket >= 0) { +#ifdef TCP_QUICKACK /* Avoid pure-ACKs while in tls protocol pingpong phase */ + /* Unfortunately we cannot be certain to do this before a TLS-on-connect + Client Hello arrives and is acked. We do it as early as possible. */ + (void) setsockopt(accept_socket, IPPROTO_TCP, TCP_QUICKACK, US &off, sizeof(off)); +#endif if (inetd_wait_timeout) last_connection_time = time(NULL); handle_smtp_call(listen_sockets, listen_socket_count, accept_socket, diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index 4cc619014..0467b2257 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -2902,13 +2902,8 @@ if (check_proxy_protocol_host()) setup_proxy_protocol_host(); #endif -#ifdef TCP_QUICKACK /* Avoid pure-ACKs while in tls protocol pingpong phase */ -(void) setsockopt(fileno(smtp_in), IPPROTO_TCP, TCP_QUICKACK, - US &off, sizeof(off)); -#endif - - /* Start up TLS if tls_on_connect is set. This is for supporting the legacy - smtps port for use with older style SSL MTAs. */ +/* Start up TLS if tls_on_connect is set. This is for supporting the legacy +smtps port for use with older style SSL MTAs. */ #ifndef DISABLE_TLS if (tls_in.on_connect) -- 2.30.2