diff --git a/src/iocore/net/P_SSLCertLookup.h b/src/iocore/net/P_SSLCertLookup.h index b40baa74c30..5d13a6300f4 100644 --- a/src/iocore/net/P_SSLCertLookup.h +++ b/src/iocore/net/P_SSLCertLookup.h @@ -26,10 +26,10 @@ #include "iocore/eventsystem/ConfigProcessor.h" #include "iocore/net/SSLTypes.h" #include "records/RecCore.h" +#include #include #include -#include #include #include @@ -94,8 +94,8 @@ using shared_ssl_ticket_key_block = std::shared_ptr; */ struct SSLCertContext { private: - mutable std::mutex ctx_mutex; - shared_SSL_CTX ctx; + mutable std::shared_mutex ctx_mutex; + shared_SSL_CTX ctx; public: SSLCertContext() : ctx_mutex(), ctx(nullptr), opt(SSLCertContextOption::OPT_NONE), userconfig(nullptr), keyblock(nullptr) {} diff --git a/src/iocore/net/SSLCertLookup.cc b/src/iocore/net/SSLCertLookup.cc index fc715fc5f90..4b51a21579e 100644 --- a/src/iocore/net/SSLCertLookup.cc +++ b/src/iocore/net/SSLCertLookup.cc @@ -33,6 +33,7 @@ #include "P_SSLUtils.h" +#include #include #include #include @@ -237,7 +238,7 @@ SSLCertContext::SSLCertContext(SSLCertContext const &other) userconfig = other.userconfig; keyblock = other.keyblock; ctx_type = other.ctx_type; - std::lock_guard lock(other.ctx_mutex); + std::shared_lock lock(other.ctx_mutex); ctx = other.ctx; } @@ -249,7 +250,7 @@ SSLCertContext::operator=(SSLCertContext const &other) this->userconfig = other.userconfig; this->keyblock = other.keyblock; this->ctx_type = other.ctx_type; - std::lock_guard lock(other.ctx_mutex); + std::shared_lock lock(other.ctx_mutex); this->ctx = other.ctx; } return *this; @@ -258,14 +259,14 @@ SSLCertContext::operator=(SSLCertContext const &other) shared_SSL_CTX SSLCertContext::getCtx() { - std::lock_guard lock(ctx_mutex); + std::shared_lock lock(ctx_mutex); return ctx; } void SSLCertContext::setCtx(shared_SSL_CTX sc) { - std::lock_guard lock(ctx_mutex); + std::lock_guard lock(ctx_mutex); ctx = std::move(sc); }