From 8923019a1d74c2d5f50eb0afe6c6a7531daac8c2 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 28 Sep 2012 20:22:13 +0200 Subject: [PATCH] BUG/MINOR: ssl: report the L4 connection as established when possible If we get an SSL error during the handshake, we at least try to see if a syscall reported an error or not. In case of an error, it generally means that the connection failed. If there is no error, then the connection established successfully. The difference is important for health checks which report the precise cause to the logs and to the stats. --- src/ssl_sock.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 71ae06f923..efef1556af 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -720,6 +720,12 @@ int ssl_sock_handshake(struct connection *conn, unsigned int flag) __conn_sock_poll_recv(conn); return 0; } + else if (ret == SSL_ERROR_SYSCALL) { + /* if errno is null, then connection was successfully established */ + if (!errno && conn->flags & CO_FL_WAIT_L4_CONN) + conn->flags &= ~CO_FL_WAIT_L4_CONN; + goto out_error; + } else { /* Fail on all other handshake errors */ goto out_error; -- 2.47.3