/*
Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
- This program is free software; you can redistribute it and/or modify
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ DCP-o-matic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
*/
#include "update_checker.h"
#include "version.h"
-#include "safe_stringstream.h"
-#include "config.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>
using std::vector;
using boost::is_any_of;
using boost::ends_with;
+using dcp::raw_convert;
/** Singleton instance */
UpdateChecker* UpdateChecker::_instance = 0;
, _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);
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 ()
}
_condition.notify_all ();
- if (_thread) {
- _thread->join ();
+ if (_thread.joinable()) {
+ try {
+ _thread.join ();
+ } catch (...) {
+
+ }
}
- delete _thread;
curl_easy_cleanup (_curl);
delete[] _buffer;
_stable = stable;
}
- if (Config::instance()->check_for_test_updates() && version_less_than (dcpomatic_version, test)) {
+ if (!test.empty() && version_less_than (dcpomatic_version, test)) {
_test = test;
}