Merge with develop

--HG--
branch : yubo
hg/yubo
Nimetu 6 years ago
commit 8b2aef9317

@ -332,7 +332,9 @@ namespace NLGUI
{ {
ERR_error_string_n(errCode, errorBuffer, 1024); ERR_error_string_n(errCode, errorBuffer, 1024);
nlwarning("Error adding certificate %s: %s", entry.name.c_str(), errorBuffer); nlwarning("Error adding certificate %s: %s", entry.name.c_str(), errorBuffer);
res = CURLE_SSL_CACERT; // There seems to be intermittent issues (on windows) where cert loading will fail for same 3 to 5 certs
// with an 'SSL_shutdown while in init' error. It does not seem to be fatal for connection.
//res = CURLE_SSL_CACERT;
} }
} }
else else

@ -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()
@ -305,7 +320,7 @@ public:
} }
} }
bool isRunning() const bool isRunning() const
{ {
return _Running; return _Running;
} }

Loading…
Cancel
Save