src: Clear OpenSSL error queue before SSL_shutdown

This commit is contained in:
Tatsuhiro Tsujikawa 2015-01-09 09:15:01 +09:00
parent 8f40bd4675
commit 473f1d71ff
5 changed files with 5 additions and 0 deletions

View File

@ -340,6 +340,7 @@ Http2Handler::~Http2Handler() {
nghttp2_session_del(session_); nghttp2_session_del(session_);
if (ssl_) { if (ssl_) {
SSL_set_shutdown(ssl_, SSL_RECEIVED_SHUTDOWN); SSL_set_shutdown(ssl_, SSL_RECEIVED_SHUTDOWN);
ERR_clear_error();
SSL_shutdown(ssl_); SSL_shutdown(ssl_);
} }
auto loop = sessions_->get_loop(); auto loop = sessions_->get_loop();

View File

@ -204,6 +204,7 @@ void Client::disconnect() {
ev_io_stop(worker->loop, &rev); ev_io_stop(worker->loop, &rev);
if (ssl) { if (ssl) {
SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN); SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN);
ERR_clear_error();
SSL_shutdown(ssl); SSL_shutdown(ssl);
SSL_free(ssl); SSL_free(ssl);
ssl = nullptr; ssl = nullptr;

View File

@ -688,6 +688,7 @@ struct HttpClient {
if (ssl) { if (ssl) {
SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN); SSL_set_shutdown(ssl, SSL_RECEIVED_SHUTDOWN);
ERR_clear_error();
SSL_shutdown(ssl); SSL_shutdown(ssl);
SSL_free(ssl); SSL_free(ssl);
ssl = nullptr; ssl = nullptr;

View File

@ -561,6 +561,7 @@ ClientHandler::~ClientHandler() {
if (ssl_) { if (ssl_) {
SSL_set_app_data(ssl_, nullptr); SSL_set_app_data(ssl_, nullptr);
SSL_set_shutdown(ssl_, SSL_RECEIVED_SHUTDOWN); SSL_set_shutdown(ssl_, SSL_RECEIVED_SHUTDOWN);
ERR_clear_error();
SSL_shutdown(ssl_); SSL_shutdown(ssl_);
} }

View File

@ -195,6 +195,7 @@ int Http2Session::disconnect(bool hard) {
if (ssl_) { if (ssl_) {
SSL_set_shutdown(ssl_, SSL_RECEIVED_SHUTDOWN); SSL_set_shutdown(ssl_, SSL_RECEIVED_SHUTDOWN);
ERR_clear_error();
SSL_shutdown(ssl_); SSL_shutdown(ssl_);
SSL_free(ssl_); SSL_free(ssl_);
ssl_ = nullptr; ssl_ = nullptr;