src: Use raw pointer for ssl_global_locks
This commit is contained in:
parent
799a76de74
commit
12a4e7c3a2
|
@ -42,12 +42,11 @@ namespace ssl {
|
||||||
|
|
||||||
// CRYPTO_LOCK is deprecated as of OpenSSL 1.1.0
|
// CRYPTO_LOCK is deprecated as of OpenSSL 1.1.0
|
||||||
LibsslGlobalLock::LibsslGlobalLock() {}
|
LibsslGlobalLock::LibsslGlobalLock() {}
|
||||||
LibsslGlobalLock::~LibsslGlobalLock() {}
|
|
||||||
|
|
||||||
#else // !OPENSSL_1_1_API
|
#else // !OPENSSL_1_1_API
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
std::vector<std::mutex> ssl_global_locks;
|
std::mutex *ssl_global_locks;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -61,11 +60,11 @@ void ssl_locking_cb(int mode, int type, const char *file, int line) {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
LibsslGlobalLock::LibsslGlobalLock() {
|
LibsslGlobalLock::LibsslGlobalLock() {
|
||||||
if (!ssl_global_locks.empty()) {
|
if (ssl_global_locks) {
|
||||||
std::cerr << "OpenSSL global lock has been already set" << std::endl;
|
std::cerr << "OpenSSL global lock has been already set" << std::endl;
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
ssl_global_locks = std::vector<std::mutex>(CRYPTO_num_locks());
|
ssl_global_locks = new std::mutex[CRYPTO_num_locks()];
|
||||||
// CRYPTO_set_id_callback(ssl_thread_id); OpenSSL manual says that
|
// CRYPTO_set_id_callback(ssl_thread_id); OpenSSL manual says that
|
||||||
// if threadid_func is not specified using
|
// if threadid_func is not specified using
|
||||||
// CRYPTO_THREADID_set_callback(), then default implementation is
|
// CRYPTO_THREADID_set_callback(), then default implementation is
|
||||||
|
@ -73,8 +72,6 @@ LibsslGlobalLock::LibsslGlobalLock() {
|
||||||
CRYPTO_set_locking_callback(ssl_locking_cb);
|
CRYPTO_set_locking_callback(ssl_locking_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
LibsslGlobalLock::~LibsslGlobalLock() { ssl_global_locks.clear(); }
|
|
||||||
|
|
||||||
#endif // !OPENSSL_1_1_API
|
#endif // !OPENSSL_1_1_API
|
||||||
|
|
||||||
const char *get_tls_protocol(SSL *ssl) {
|
const char *get_tls_protocol(SSL *ssl) {
|
||||||
|
|
|
@ -40,7 +40,6 @@ namespace ssl {
|
||||||
class LibsslGlobalLock {
|
class LibsslGlobalLock {
|
||||||
public:
|
public:
|
||||||
LibsslGlobalLock();
|
LibsslGlobalLock();
|
||||||
~LibsslGlobalLock();
|
|
||||||
LibsslGlobalLock(const LibsslGlobalLock &) = delete;
|
LibsslGlobalLock(const LibsslGlobalLock &) = delete;
|
||||||
LibsslGlobalLock &operator=(const LibsslGlobalLock &) = delete;
|
LibsslGlobalLock &operator=(const LibsslGlobalLock &) = delete;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue