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/Crypto/Crypto.h"
|
||||||
#include "Poco/Mutex.h"
|
#include "Poco/Mutex.h"
|
||||||
|
#include "Poco/AtomicCounter.h"
|
||||||
#include <openssl/crypto.h>
|
#include <openssl/crypto.h>
|
||||||
#include <openssl/opensslv.h>
|
#include <openssl/opensslv.h>
|
||||||
#if defined(OPENSSL_FIPS) && OPENSSL_VERSION_NUMBER < 0x010001000L
|
#if defined(OPENSSL_FIPS) && OPENSSL_VERSION_NUMBER < 0x010001000L
|
||||||
|
@ -82,8 +83,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Poco::FastMutex* _mutexes;
|
static Poco::FastMutex* _mutexes;
|
||||||
static Poco::FastMutex _mutex;
|
static Poco::AtomicCounter _rc;
|
||||||
static int _rc;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,7 @@ namespace Crypto {
|
||||||
|
|
||||||
|
|
||||||
Poco::FastMutex* OpenSSLInitializer::_mutexes(0);
|
Poco::FastMutex* OpenSSLInitializer::_mutexes(0);
|
||||||
Poco::FastMutex OpenSSLInitializer::_mutex;
|
Poco::AtomicCounter OpenSSLInitializer::_rc;
|
||||||
int OpenSSLInitializer::_rc(0);
|
|
||||||
|
|
||||||
|
|
||||||
OpenSSLInitializer::OpenSSLInitializer()
|
OpenSSLInitializer::OpenSSLInitializer()
|
||||||
|
@ -60,8 +59,6 @@ OpenSSLInitializer::~OpenSSLInitializer()
|
||||||
|
|
||||||
void OpenSSLInitializer::initialize()
|
void OpenSSLInitializer::initialize()
|
||||||
{
|
{
|
||||||
Poco::FastMutex::ScopedLock lock(_mutex);
|
|
||||||
|
|
||||||
if (++_rc == 1)
|
if (++_rc == 1)
|
||||||
{
|
{
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x0907000L
|
#if OPENSSL_VERSION_NUMBER >= 0x0907000L
|
||||||
|
@ -98,8 +95,6 @@ void OpenSSLInitializer::initialize()
|
||||||
|
|
||||||
void OpenSSLInitializer::uninitialize()
|
void OpenSSLInitializer::uninitialize()
|
||||||
{
|
{
|
||||||
Poco::FastMutex::ScopedLock lock(_mutex);
|
|
||||||
|
|
||||||
if (--_rc == 0)
|
if (--_rc == 0)
|
||||||
{
|
{
|
||||||
EVP_cleanup();
|
EVP_cleanup();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче