More player debugging for butler video-full states.
[dcpomatic.git] / src / lib / update_checker.cc
index e3bbd663ee254af8abbc68fabf71774edb2141f6..98e4078225d36f8619d4d34cd2e2fa3c3f24d639 100644 (file)
@@ -20,9 +20,8 @@
 
 #include "update_checker.h"
 #include "version.h"
-#include "safe_stringstream.h"
 #include "util.h"
-#include "raw_convert.h"
+#include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
 #include <curl/curl.h>
 #include <boost/algorithm/string.hpp>
@@ -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;
@@ -62,7 +62,7 @@ UpdateChecker::UpdateChecker ()
 {
        _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);
@@ -75,6 +75,9 @@ void
 UpdateChecker::start ()
 {
        _thread = new boost::thread (boost::bind (&UpdateChecker::thread, this));
+#ifdef DCPOMATIC_LINUX
+       pthread_setname_np (_thread->native_handle(), "update-checker");
+#endif
 }
 
 UpdateChecker::~UpdateChecker ()
@@ -86,8 +89,12 @@ UpdateChecker::~UpdateChecker ()
 
        _condition.notify_all ();
        if (_thread) {
-               DCPOMATIC_ASSERT (_thread->joinable ());
-               _thread->join ();
+               /* Ideally this would be a DCPOMATIC_ASSERT(_thread->joinable()) but we
+                  can't throw exceptions from a destructor.
+               */
+               if (_thread->joinable ()) {
+                       _thread->join ();
+               }
        }
        delete _thread;
 
@@ -154,7 +161,7 @@ UpdateChecker::thread ()
                                _stable = stable;
                        }
 
-                       if (version_less_than (dcpomatic_version, test)) {
+                       if (!test.empty() && version_less_than (dcpomatic_version, test)) {
                                _test = test;
                        }