about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--irc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/irc.c b/irc.c
index dc40201..61d74bb 100644
--- a/irc.c
+++ b/irc.c
@@ -162,6 +162,11 @@ 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));
 
+	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;
 }