Print openssl error on TLS error

This commit is contained in:
Sergey Lyubka committed 2021-08-30 11:45:30 +01:00
1 parent 28a56370d4
commit 40b99e3751
2 files changed
+4 -2

No files matched your search

+2 -1
View File
@@ -3875,6 +3875,8 @@ static int mg_tls_err(struct mg_tls *tls, int res) {
// - *ALL* SSL accepted connection report read error on the next poll cycle.
// Thus a single errored connection can close all the rest, unrelated ones.
// Clearing the error keeps the shared SSL_CTX in an OK state.
if (err != 0) ERR_print_errors_fp(stderr);
ERR_clear_error();
if (err == SSL_ERROR_WANT_READ) return 0;
if (err == SSL_ERROR_WANT_WRITE) return 0;
@@ -3982,7 +3984,6 @@ void mg_tls_handshake(struct mg_connection *c) {
c->is_tls_hs = 0;
} else {
int code = mg_tls_err(tls, rc);
ERR_print_errors_fp(stderr);
if (code != 0) mg_error(c, "tls hs: rc %d, err %d", rc, code);
}
}
+2 -1
View File
@@ -227,6 +227,8 @@ static int mg_tls_err(struct mg_tls *tls, int res) {
// - *ALL* SSL accepted connection report read error on the next poll cycle.
// Thus a single errored connection can close all the rest, unrelated ones.
// Clearing the error keeps the shared SSL_CTX in an OK state.
if (err != 0) ERR_print_errors_fp(stderr);
ERR_clear_error();
if (err == SSL_ERROR_WANT_READ) return 0;
if (err == SSL_ERROR_WANT_WRITE) return 0;
@@ -334,7 +336,6 @@ void mg_tls_handshake(struct mg_connection *c) {
c->is_tls_hs = 0;
} else {
int code = mg_tls_err(tls, rc);
ERR_print_errors_fp(stderr);
if (code != 0) mg_error(c, "tls hs: rc %d, err %d", rc, code);
}
}