about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-08-20 15:52:50 -0400
committerJune McEnroe <june@causal.agency>2021-08-20 15:53:29 -0400
commitbec7281de7ac3fb5845cd860ac70f848380ce8cd (patch)
treeace51519d1b1fd15162ccd959a46cc5e19a57e79
parentUse "secure" libtls ciphers (diff)
downloadpounce-bec7281de7ac3fb5845cd860ac70f848380ce8cd.tar.gz
pounce-bec7281de7ac3fb5845cd860ac70f848380ce8cd.zip
Handle TLS_WANT_POLL{IN,OUT} from tls_handshake(3) with server
-rw-r--r--server.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/server.c b/server.c
index 853edd8..c84320a 100644
--- a/server.c
+++ b/server.c
@@ -146,7 +146,9 @@ int serverConnect(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;