X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fupdate_checker.cc;h=82337f92016905420316ad19daa1d1779804ffcf;hb=fa5f3a8bf77209da27acc33cf144e2e4500a2600;hp=e3bbd663ee254af8abbc68fabf71774edb2141f6;hpb=3828baf56467224f5d44049bf1e7a7ed11f43a05;p=dcpomatic.git diff --git a/src/lib/update_checker.cc b/src/lib/update_checker.cc index e3bbd663e..82337f920 100644 --- a/src/lib/update_checker.cc +++ b/src/lib/update_checker.cc @@ -20,9 +20,8 @@ #include "update_checker.h" #include "version.h" -#include "safe_stringstream.h" #include "util.h" -#include "raw_convert.h" +#include #include #include #include @@ -37,6 +36,7 @@ using std::string; using std::vector; using boost::is_any_of; using boost::ends_with; +using dcp::raw_convert; /** Singleton instance */ UpdateChecker* UpdateChecker::_instance = 0; @@ -56,13 +56,12 @@ UpdateChecker::UpdateChecker () , _curl (0) , _state (NOT_RUN) , _emits (0) - , _thread (0) , _to_do (0) , _terminate (false) { _curl = curl_easy_init (); - curl_easy_setopt (_curl, CURLOPT_URL, "http://dcpomatic.com/update"); + curl_easy_setopt (_curl, CURLOPT_URL, "https://dcpomatic.com/update"); curl_easy_setopt (_curl, CURLOPT_WRITEFUNCTION, write_callback_wrapper); curl_easy_setopt (_curl, CURLOPT_WRITEDATA, this); curl_easy_setopt (_curl, CURLOPT_TIMEOUT, 20); @@ -74,7 +73,10 @@ UpdateChecker::UpdateChecker () void UpdateChecker::start () { - _thread = new boost::thread (boost::bind (&UpdateChecker::thread, this)); + _thread = boost::thread (boost::bind (&UpdateChecker::thread, this)); +#ifdef DCPOMATIC_LINUX + pthread_setname_np (_thread.native_handle(), "update-checker"); +#endif } UpdateChecker::~UpdateChecker () @@ -85,11 +87,13 @@ UpdateChecker::~UpdateChecker () } _condition.notify_all (); - if (_thread) { - DCPOMATIC_ASSERT (_thread->joinable ()); - _thread->join (); + if (_thread.joinable()) { + try { + _thread.join (); + } catch (...) { + + } } - delete _thread; curl_easy_cleanup (_curl); delete[] _buffer; @@ -154,7 +158,7 @@ UpdateChecker::thread () _stable = stable; } - if (version_less_than (dcpomatic_version, test)) { + if (!test.empty() && version_less_than (dcpomatic_version, test)) { _test = test; }