summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-01-11 20:50:09 +0100
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-01-15 19:03:38 +0100
commitf53fe9bc1fefbb15d3626912093112b511a632c8 (patch)
tree72183cb3788e666e792cd252c713f0d0f69f1812
parentcced4fae9d424c3d715244c301b2f124f894fa8d (diff)
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
-rw-r--r--src/IO/tls_openssl.c3
1 files changed, 2 insertions, 1 deletions
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;