Skip to content

Commit

Permalink
Add SSLHelper::InitThreadSafeSupport for initialize the OpenSSL thr…
Browse files Browse the repository at this point in the history
…ead safe.
  • Loading branch information
IronsDu committed Jun 3, 2024
1 parent 11c1163 commit 5713f2b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions include/brynet/net/SSLHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,16 @@ class SSLHelper : public brynet::base::NonCopyable,
using Ptr = std::shared_ptr<SSLHelper>;

#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)
{
Expand Down

0 comments on commit 5713f2b

Please sign in to comment.