summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2016-10-04 15:39:58 +0000
committerjsing <jsing@openbsd.org>2016-10-04 15:39:58 +0000
commit761a2111af59136c87d981bbb1d2ad38f4e004d4 (patch)
treec00b8d1a0b08d36f030efcec8fa8469fbbed7fe3
parentslightly smarter parsing of error log (diff)
downloadwireguard-openbsd-761a2111af59136c87d981bbb1d2ad38f4e004d4.tar.xz
wireguard-openbsd-761a2111af59136c87d981bbb1d2ad38f4e004d4.zip
tls_close() can return TLS_WANT_POLLIN/TLS_WANT_POLLOUT - handle this
case correctly. ok florian@
-rw-r--r--usr.sbin/acme-client/http.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/acme-client/http.c b/usr.sbin/acme-client/http.c
index 7199dfc21a6..0033f070125 100644
--- a/usr.sbin/acme-client/http.c
+++ b/usr.sbin/acme-client/http.c
@@ -1,4 +1,4 @@
-/* $Id: http.c,v 1.11 2016/09/24 15:24:48 jsing Exp $ */
+/* $Id: http.c,v 1.12 2016/10/04 15:39:58 jsing Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -152,12 +152,18 @@ http_write(const char *buf, size_t sz, const struct http *http)
void
http_disconnect(struct http *http)
{
+ int rc;
if (NULL != http->ctx) {
/* TLS connection. */
- if (-1 == tls_close(http->ctx))
+ do {
+ rc = tls_close(http->ctx);
+ } while (TLS_WANT_POLLIN == rc || TLS_WANT_POLLOUT == rc);
+
+ if (rc < 0)
warnx("%s: tls_close: %s", http->src.ip,
tls_error(http->ctx));
+
tls_free(http->ctx);
}
if (-1 != http->fd) {