about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-06-20 16:48:53 -0400
committerJune McEnroe <june@causal.agency>2021-06-20 16:48:53 -0400
commitb3631a7e325ee98b73f6544ae7174d7c0e8a3025 (patch)
tree5623649b2e589a6290a49c165aafb3a78ad23a72
parentAdd -m mode option to set user modes (diff)
downloadcatgirl-b3631a7e325ee98b73f6544ae7174d7c0e8a3025.tar.gz
catgirl-b3631a7e325ee98b73f6544ae7174d7c0e8a3025.zip
Handle TLS_WANNT_POLL{IN,OUT} from tls_handshake(3)
For blocking sockets it should be retried immediately.
Diffstat (limited to '')
-rw-r--r--irc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/irc.c b/irc.c
index 166d4ed..089f9ea 100644
--- a/irc.c
+++ b/irc.c
@@ -165,7 +165,9 @@ int ircConnect(const char *bindHost, const char *host, const char *port) {
 	error = tls_connect_socket(client, sock, host);
 	if (error) errx(EX_PROTOCOL, "tls_connect: %s", tls_error(client));
 
-	error = tls_handshake(client);
+	do {
+		error = tls_handshake(client);
+	} while (error == TLS_WANT_POLLIN || error == TLS_WANT_POLLOUT);
 	if (error) errx(EX_PROTOCOL, "tls_handshake: %s", tls_error(client));
 
 	return sock;