From 48d398a186afb0c71eb2fc05328f4fed580f975e Mon Sep 17 00:00:00 2001
From: Quentin Armitage <quentin@armitage.org.uk>
Date: Wed, 28 Oct 2020 16:10:01 +0000
Subject: [PATCH 426/691] ipvs: fix a file descriptor leak with SSL_GET

Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
---
 keepalived/check/check_ssl.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/keepalived/check/check_ssl.c b/keepalived/check/check_ssl.c
index c7fb2ca..2999244 100644
--- a/keepalived/check/check_ssl.c
+++ b/keepalived/check/check_ssl.c
@@ -301,8 +301,8 @@ ssl_read_thread(thread_ref_t thread)
 	if (req->error == SSL_ERROR_WANT_READ) {
 		 /* async read unfinished */
 		thread_add_read(thread->master, ssl_read_thread, checker,
-				thread->u.f.fd, timeout, false);
-	} else if (r > 0 && req->error == 0) {
+				thread->u.f.fd, timeout, true);
+	} else if (r > 0 && req->error == SSL_ERROR_NONE) {
 		/* Handle response stream */
 		http_process_response(req, (size_t)r, url);
 
@@ -311,10 +311,9 @@ ssl_read_thread(thread_ref_t thread)
 		 * Register itself to not perturbe global I/O multiplexer.
 		 */
 		thread_add_read(thread->master, ssl_read_thread, checker,
-				thread->u.f.fd, timeout, false);
+				thread->u.f.fd, timeout, true);
 	} else if (req->error) {
-
-		/* All the SSL streal has been parsed */
+		/* All the SSL stream has been parsed */
 		if (url->digest)
 			MD5_Final(digest, &req->context);
 		SSL_set_quiet_shutdown(req->ssl, 1);
-- 
1.8.3.1

