commit c783ccce7fb5e05d59bfc8815ba7191362632d96
parent 64f5d81b5f7a51f072db45d8662563e6d8ec7307
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sun, 14 Mar 2021 23:17:08 +0100
Fix new libretls API with POLL* stuff.
Diffstat:
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/imap.c b/imap.c
@@ -568,7 +568,6 @@ imap_spuriouscapability(imap_t *imap)
 
 	lineres = NULL;
 	retval = imap_parseline(imap, &lineres);
-
 	if (retval == -1 && lineres != NULL) {
 		retval = imap_capabilityset(imap, lineres);
 		if (!retval) {
diff --git a/net.c b/net.c
@@ -274,7 +274,12 @@ net_writetcp(net_t *net, char *buf, int len)
 int
 net_writetcps(net_t *net, char *buf, int len)
 {
-	return tls_write((struct tls *)net->data[0], buf, len);
+	int r = TLS_WANT_POLLIN;
+
+	while (r == TLS_WANT_POLLIN || r == TLS_WANT_POLLOUT)
+		r = tls_write((struct tls *)net->data[0], buf, len);
+
+	return r;
 }
 
 int
@@ -334,7 +339,12 @@ net_readtcp(net_t *net, char *buf, int len)
 int
 net_readtcps(net_t *net, char *buf, int len)
 {
-	return tls_read((struct tls *)net->data[0], buf, len);
+	int r = TLS_WANT_POLLIN;
+
+	while (r == TLS_WANT_POLLIN || r == TLS_WANT_POLLOUT)
+		r = tls_read((struct tls *)net->data[0], buf, len);
+
+	return r;
 }
 
 int