Fixed: WebIG notif thread did not have curl certificates loaded.
--HG-- branch : develop
This commit is contained in:
parent
1163d11ede
commit
c439a10cfe
1 changed files with 19 additions and 4 deletions
|
@ -30,6 +30,7 @@
|
||||||
#include "../connection.h"
|
#include "../connection.h"
|
||||||
|
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
#include "nel/gui/curl_certificates.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
@ -168,6 +169,17 @@ public:
|
||||||
_Thread = NULL;
|
_Thread = NULL;
|
||||||
curl_global_init(CURL_GLOBAL_ALL);
|
curl_global_init(CURL_GLOBAL_ALL);
|
||||||
|
|
||||||
|
Curl = NULL;
|
||||||
|
//nlinfo("ctor CWebigNotificationThread");
|
||||||
|
}
|
||||||
|
|
||||||
|
void init()
|
||||||
|
{
|
||||||
|
if (Curl)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Curl = curl_easy_init();
|
Curl = curl_easy_init();
|
||||||
if(!Curl) return;
|
if(!Curl) return;
|
||||||
curl_easy_setopt(Curl, CURLOPT_COOKIEFILE, "");
|
curl_easy_setopt(Curl, CURLOPT_COOKIEFILE, "");
|
||||||
|
@ -175,7 +187,8 @@ public:
|
||||||
curl_easy_setopt(Curl, CURLOPT_USERAGENT, getUserAgent().c_str());
|
curl_easy_setopt(Curl, CURLOPT_USERAGENT, getUserAgent().c_str());
|
||||||
curl_easy_setopt(Curl, CURLOPT_FOLLOWLOCATION, 1);
|
curl_easy_setopt(Curl, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
curl_easy_setopt(Curl, CURLOPT_WRITEFUNCTION, writeDataFromCurl);
|
curl_easy_setopt(Curl, CURLOPT_WRITEFUNCTION, writeDataFromCurl);
|
||||||
//nlinfo("ctor CWebigNotificationThread");
|
|
||||||
|
NLGUI::CCurlCertificates::useCertificates(Curl);
|
||||||
}
|
}
|
||||||
|
|
||||||
~CWebigNotificationThread()
|
~CWebigNotificationThread()
|
||||||
|
@ -183,7 +196,7 @@ public:
|
||||||
if(Curl)
|
if(Curl)
|
||||||
{
|
{
|
||||||
curl_easy_cleanup(Curl);
|
curl_easy_cleanup(Curl);
|
||||||
Curl = 0;
|
Curl = NULL;
|
||||||
}
|
}
|
||||||
if (_Thread)
|
if (_Thread)
|
||||||
{
|
{
|
||||||
|
@ -275,6 +288,9 @@ public:
|
||||||
|
|
||||||
void startThread()
|
void startThread()
|
||||||
{
|
{
|
||||||
|
// initialize curl outside thread
|
||||||
|
init();
|
||||||
|
|
||||||
if (!_Thread)
|
if (!_Thread)
|
||||||
{
|
{
|
||||||
_Thread = IThread::create(this);
|
_Thread = IThread::create(this);
|
||||||
|
@ -286,7 +302,6 @@ public:
|
||||||
{
|
{
|
||||||
nlwarning("WebIgNotification thread already started");
|
nlwarning("WebIgNotification thread already started");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopThread()
|
void stopThread()
|
||||||
|
|
Loading…
Reference in a new issue