Update CertReloader.cpp

This commit is contained in:
alexey-milovidov 2021-07-07 01:19:26 +03:00 committed by GitHub
parent 019edee013
commit f3c8821919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ int cert_reloader_dispatch_set_cert(SSL * ssl, [[maybe_unused]] void * arg)
int CertReloader::SetCert(SSL * ssl) int CertReloader::SetCert(SSL * ssl)
{ {
std::shared_lock lock(lck); std::shared_lock lock(mutex);
SSL_use_certificate(ssl, const_cast<X509 *>(cert->certificate())); SSL_use_certificate(ssl, const_cast<X509 *>(cert->certificate()));
SSL_use_RSAPrivateKey(ssl, key->impl()->getRSA()); SSL_use_RSAPrivateKey(ssl, key->impl()->getRSA());
@ -50,7 +50,7 @@ void CertReloader::reload(const Poco::Util::AbstractConfiguration & config)
{ {
LOG_INFO(log, "Reloading cert({}), key({})", cert_file, key_file); LOG_INFO(log, "Reloading cert({}), key({})", cert_file, key_file);
{ {
std::unique_lock lock(lck); std::unique_lock lock(mutex);
key.reset(new Poco::Crypto::RSAKey("", key_file)); key.reset(new Poco::Crypto::RSAKey("", key_file));
cert.reset(new Poco::Crypto::X509Certificate(cert_file)); cert.reset(new Poco::Crypto::X509Certificate(cert_file));
} }