Make sure we don't accidentally initialize libcurl in a thread

This commit is contained in:
heinrich5991 2022-05-23 17:18:55 +02:00
parent 76ed324b66
commit c93658f929

View file

@ -20,6 +20,7 @@
// TODO: Non-global pls?
static CURLSH *gs_Share;
static LOCK gs_aLocks[CURL_LOCK_DATA_LAST + 1];
static bool gs_Initialized = false;
static int GetLockIndex(int Data)
{
@ -105,6 +106,8 @@ bool HttpInit(IStorage *pStorage)
signal(SIGPIPE, SIG_IGN);
#endif
gs_Initialized = true;
return false;
}
@ -141,6 +144,7 @@ CHttpRequest::~CHttpRequest()
void CHttpRequest::Run()
{
dbg_assert(gs_Initialized, "must initialize HTTP before running HTTP requests");
int FinalState;
if(!BeforeInit())
{