]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: session: handshake timeout (TCP)
authorFrédéric Lécaille <flecaille@haproxy.com>
Wed, 15 Nov 2023 13:24:10 +0000 (14:24 +0100)
committerFrédéric Lécaille <flecaille@haproxy.com>
Fri, 17 Nov 2023 16:31:42 +0000 (17:31 +0100)
Adapt session_accept_fd() called on accept() to set the handshake timeout from
"hanshake-timeout" setting if set by configuration. If not set, continue to use
the "client" timeout setting.

src/session.c

index 68dd4bc87e81a5967a2fc7eeae2105c626dd32d3..c090c7c040c1b649c9d5f70750a490e6ff56952f 100644 (file)
@@ -279,13 +279,19 @@ int session_accept_fd(struct connection *cli_conn)
         *          conn -- owner ---> task <-----+
         */
        if (cli_conn->flags & (CO_FL_WAIT_XPRT | CO_FL_EARLY_SSL_HS)) {
+               int timeout;
+               int clt_tmt = p->timeout.client;
+               int hs_tmt = p->timeout.handshake;
+
                if (unlikely((sess->task = task_new_here()) == NULL))
                        goto out_free_sess;
 
+               /* Handshake timeout as default timeout */
+               timeout = hs_tmt ? hs_tmt : clt_tmt;
                sess->task->context = sess;
                sess->task->nice    = l->bind_conf->nice;
                sess->task->process = session_expire_embryonic;
-               sess->task->expire  = tick_add_ifset(now_ms, p->timeout.client);
+               sess->task->expire  = tick_add_ifset(now_ms, timeout);
                task_queue(sess->task);
                return 1;
        }