nghttpx: Call ERR_clear_error()

Call ERR_clear_error() before the OpenSSL function if we use
SSL_get_error() to examine error stack.
This commit is contained in:
Tatsuhiro Tsujikawa 2017-05-21 10:32:12 +09:00
parent 9c1876f542
commit ed1fad3bd4
1 changed files with 6 additions and 0 deletions

View File

@ -381,6 +381,8 @@ int Connection::tls_handshake() {
break; break;
} }
ERR_clear_error();
auto rv = SSL_do_handshake(tls.ssl); auto rv = SSL_do_handshake(tls.ssl);
if (rv <= 0) { if (rv <= 0) {
@ -615,6 +617,8 @@ ssize_t Connection::write_tls(const void *data, size_t len) {
tls.last_write_idle = -1.; tls.last_write_idle = -1.;
ERR_clear_error();
auto rv = SSL_write(tls.ssl, data, len); auto rv = SSL_write(tls.ssl, data, len);
if (rv <= 0) { if (rv <= 0) {
@ -667,6 +671,8 @@ ssize_t Connection::read_tls(void *data, size_t len) {
tls.last_readlen = 0; tls.last_readlen = 0;
} }
ERR_clear_error();
auto rv = SSL_read(tls.ssl, data, len); auto rv = SSL_read(tls.ssl, data, len);
if (rv <= 0) { if (rv <= 0) {