From f53fe9bc1fefbb15d3626912093112b511a632c8 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 11 Jan 2024 20:50:09 +0100 Subject: Remove fd watch while perforing TLS check Avoids calling the callback while the TLS dialog is opened, which was causing and infinite loop of recursive calls to Tls_connect(). Fixes: https://github.com/dillo-browser/dillo/issues/49 --- src/IO/tls_openssl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/IO/tls_openssl.c b/src/IO/tls_openssl.c index 18367e64..d686c472 100644 --- a/src/IO/tls_openssl.c +++ b/src/IO/tls_openssl.c @@ -1087,6 +1087,8 @@ static void Tls_connect(int fd, int connkey) ret = SSL_connect(conn->ssl); + a_IOwatch_remove_fd(fd, -1); + if (ret <= 0) { int err1_ret = SSL_get_error(conn->ssl, ret); if (err1_ret == SSL_ERROR_WANT_READ || @@ -1095,7 +1097,6 @@ static void Tls_connect(int fd, int connkey) _MSG("iowatching fd %d for tls -- want %s\n", fd, err1_ret == SSL_ERROR_WANT_READ ? "read" : "write"); - a_IOwatch_remove_fd(fd, -1); a_IOwatch_add_fd(fd, want, Tls_connect_cb, INT2VOIDP(connkey)); ongoing = TRUE; failed = FALSE; -- cgit v1.2.3