fixed GH #500: SSLManager causes a crash (use AtomicCounter, remove static Mutex)
This commit is contained in:
Родитель
b620c25278
Коммит
4152b569c0
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Mutex.h"
|
||||
#include "Poco/AtomicCounter.h"
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/opensslv.h>
|
||||
#if defined(OPENSSL_FIPS) && OPENSSL_VERSION_NUMBER < 0x010001000L
|
||||
|
@ -82,8 +83,7 @@ protected:
|
|||
|
||||
private:
|
||||
static Poco::FastMutex* _mutexes;
|
||||
static Poco::FastMutex _mutex;
|
||||
static int _rc;
|
||||
static Poco::AtomicCounter _rc;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@ namespace Crypto {
|
|||
|
||||
|
||||
Poco::FastMutex* OpenSSLInitializer::_mutexes(0);
|
||||
Poco::FastMutex OpenSSLInitializer::_mutex;
|
||||
int OpenSSLInitializer::_rc(0);
|
||||
Poco::AtomicCounter OpenSSLInitializer::_rc;
|
||||
|
||||
|
||||
OpenSSLInitializer::OpenSSLInitializer()
|
||||
|
@ -60,8 +59,6 @@ OpenSSLInitializer::~OpenSSLInitializer()
|
|||
|
||||
void OpenSSLInitializer::initialize()
|
||||
{
|
||||
Poco::FastMutex::ScopedLock lock(_mutex);
|
||||
|
||||
if (++_rc == 1)
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x0907000L
|
||||
|
@ -98,8 +95,6 @@ void OpenSSLInitializer::initialize()
|
|||
|
||||
void OpenSSLInitializer::uninitialize()
|
||||
{
|
||||
Poco::FastMutex::ScopedLock lock(_mutex);
|
||||
|
||||
if (--_rc == 0)
|
||||
{
|
||||
EVP_cleanup();
|
||||
|
|
Загрузка…
Ссылка в новой задаче