tls: add tls_connect debug
@@ -147,8 +147,6 @@ static int tls_connect(struct tls_conn *tc)
if (r <= 0) {
const int ssl_err = SSL_get_error(tc->ssl, r);
- ERR_clear_error();
-
switch (ssl_err) {
case SSL_ERROR_WANT_READ:
@@ -157,9 +155,12 @@ static int tls_connect(struct tls_conn *tc)
default:
DEBUG_WARNING("connect: error (r=%d, ssl_err=%d)\n",
r, ssl_err);
+ tls_flush_error();
err = EPROTO;
break;
}
+
+ ERR_clear_error();
}
return err;
