Initialize the CURL library in a thread-safe way

This commit is contained in:
Cameron Gutman 2018-11-17 12:04:54 -08:00
parent 4613d4977c
commit 918b528648

View File

@ -10,6 +10,8 @@
#include <openssl/bio.h>
#include <openssl/pem.h>
#include <curl/curl.h>
X509 *g_Cert;
EVP_PKEY *g_PrivateKey;
char *g_UniqueId;
@ -85,11 +87,13 @@ void MoonlightInstance::NvHTTPInit(int32_t callbackId, pp::VarArray args)
LoadCert(_cert.c_str(), _key.c_str());
g_UniqueId = strdup(_uniqueId.c_str());
curl_global_init(CURL_GLOBAL_DEFAULT);
pp::VarDictionary ret;
ret.Set("callbackId", pp::Var(callbackId));
ret.Set("type", pp::Var("resolve"));
ret.Set("ret", pp::Var(""));
ret.Set("ret", pp::Var());
PostMessage(ret);
}