diff --git a/include/brynet/net/SSLHelper.hpp b/include/brynet/net/SSLHelper.hpp index f47a207..7863431 100644 --- a/include/brynet/net/SSLHelper.hpp +++ b/include/brynet/net/SSLHelper.hpp @@ -82,11 +82,16 @@ class SSLHelper : public brynet::base::NonCopyable, using Ptr = std::shared_ptr; #ifdef BRYNET_USE_OPENSSL - bool initSSL(const std::string& certificate, - const std::string& privatekey) + static void InitThreadSafeSupport() { std::call_once(initCryptoThreadSafeSupportOnceFlag, InitCryptoThreadSafeSupport); + } + + bool initSSL(const std::string& certificate, + const std::string& privatekey) + { + SSLHelper::InitThreadSafeSupport(); if (mOpenSSLCTX != nullptr) {