Updated updater. Yes, the irony is not lost on me.
This commit is contained in:
parent
0eca65e433
commit
bf382cbea0
4 changed files with 155 additions and 193 deletions
|
@ -104,21 +104,9 @@ void createAccount (std::string account){
|
||||||
/// Status monitoring thread.
|
/// Status monitoring thread.
|
||||||
/// Will check outputs, inputs and converters every five seconds
|
/// Will check outputs, inputs and converters every five seconds
|
||||||
void statusMonitor(void * np){
|
void statusMonitor(void * np){
|
||||||
#ifdef UPDATER
|
|
||||||
unsigned long updatechecker = Util::epoch(); /*LTS*/
|
|
||||||
#endif
|
|
||||||
IPC::semaphore configLock(SEM_CONF, O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
IPC::semaphore configLock(SEM_CONF, O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||||
Controller::loadActiveConnectors();
|
Controller::loadActiveConnectors();
|
||||||
while (Controller::conf.is_active){
|
while (Controller::conf.is_active){
|
||||||
/*LTS-START*/
|
|
||||||
#ifdef UPDATER
|
|
||||||
if (Util::epoch() - updatechecker > 3600){
|
|
||||||
updatechecker = Util::epoch();
|
|
||||||
Controller::CheckUpdateInfo();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*LTS-END*/
|
|
||||||
|
|
||||||
//this scope prevents the configMutex from being locked constantly
|
//this scope prevents the configMutex from being locked constantly
|
||||||
{
|
{
|
||||||
tthread::lock_guard<tthread::mutex> guard(Controller::configMutex);
|
tthread::lock_guard<tthread::mutex> guard(Controller::configMutex);
|
||||||
|
@ -349,7 +337,7 @@ int main_loop(int argc, char ** argv){
|
||||||
/*LTS-START*/
|
/*LTS-START*/
|
||||||
#ifdef UPDATER
|
#ifdef UPDATER
|
||||||
if (Controller::conf.getBool("update")){
|
if (Controller::conf.getBool("update")){
|
||||||
Controller::CheckUpdates();
|
Controller::checkUpdates();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef LICENSING
|
#ifdef LICENSING
|
||||||
|
@ -370,6 +358,10 @@ int main_loop(int argc, char ** argv){
|
||||||
tthread::thread pushThread(Controller::pushCheckLoop, 0);
|
tthread::thread pushThread(Controller::pushCheckLoop, 0);
|
||||||
//start UDP API thread
|
//start UDP API thread
|
||||||
tthread::thread UDPAPIThread(Controller::handleUDPAPI, 0);
|
tthread::thread UDPAPIThread(Controller::handleUDPAPI, 0);
|
||||||
|
#ifdef UPDATER
|
||||||
|
//start updater thread
|
||||||
|
tthread::thread updaterThread(Controller::updateThread, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//start main loop
|
//start main loop
|
||||||
|
@ -424,6 +416,10 @@ int main_loop(int argc, char ** argv){
|
||||||
HIGH_MSG("Joining license thread...");
|
HIGH_MSG("Joining license thread...");
|
||||||
licenseThread.join();
|
licenseThread.join();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef UPDATER
|
||||||
|
HIGH_MSG("Joining updater thread...");
|
||||||
|
updaterThread.join();
|
||||||
|
#endif
|
||||||
/*LTS-END*/
|
/*LTS-END*/
|
||||||
//write config
|
//write config
|
||||||
tthread::lock_guard<tthread::mutex> guard(Controller::logMutex);
|
tthread::lock_guard<tthread::mutex> guard(Controller::logMutex);
|
||||||
|
|
|
@ -404,13 +404,10 @@ void Controller::handleAPICommands(JSON::Value & Request, JSON::Value & Response
|
||||||
///
|
///
|
||||||
#ifdef UPDATER
|
#ifdef UPDATER
|
||||||
if (Request.isMember("autoupdate")){
|
if (Request.isMember("autoupdate")){
|
||||||
Controller::CheckUpdates();
|
Controller::checkUpdates();
|
||||||
}
|
}
|
||||||
if (Request.isMember("checkupdate")){
|
if (Request.isMember("update") || Request.isMember("checkupdate") || Request.isMember("autoupdate")){
|
||||||
Controller::updates = Controller::CheckUpdateInfo();
|
Controller::insertUpdateInfo(Response["update"]);
|
||||||
}
|
|
||||||
if (Request.isMember("update") || Request.isMember("checkupdate")){
|
|
||||||
Response["update"] = Controller::updates;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*LTS-END*/
|
/*LTS-END*/
|
||||||
|
|
|
@ -1,87 +1,112 @@
|
||||||
/// \file controller_updater.cpp
|
/// \file controller_updater.cpp
|
||||||
/// Contains all code for the controller updater.
|
/// Contains all code for the controller updater.
|
||||||
|
|
||||||
#include <fstream> //for files
|
|
||||||
#include <iostream> //for stdio
|
|
||||||
#include <unistd.h> //for unlink
|
|
||||||
#include <sys/stat.h> //for chmod
|
|
||||||
#include <stdlib.h> //for srand, rand
|
|
||||||
#include <time.h> //for time
|
|
||||||
#include <signal.h> //for raise
|
|
||||||
#include <mist/http_parser.h>
|
|
||||||
#include <mist/socket.h>
|
|
||||||
#include <mist/auth.h>
|
|
||||||
#include <mist/timing.h>
|
|
||||||
#include <mist/config.h>
|
|
||||||
#include "controller_storage.h"
|
|
||||||
#include "controller_connectors.h"
|
|
||||||
#include "controller_updater.h"
|
#include "controller_updater.h"
|
||||||
|
#include "controller_connectors.h"
|
||||||
|
#include "controller_storage.h"
|
||||||
|
#include <fstream> //for files
|
||||||
|
#include <iostream> //for stdio
|
||||||
|
#include <mist/auth.h>
|
||||||
|
#include <mist/config.h>
|
||||||
|
#include <mist/defines.h>
|
||||||
|
#include <mist/http_parser.h>
|
||||||
|
#include <mist/timing.h>
|
||||||
|
#include <signal.h> //for raise
|
||||||
|
#include <sys/stat.h> //for chmod
|
||||||
|
#include <time.h> //for time
|
||||||
|
#include <unistd.h> //for unlink
|
||||||
|
|
||||||
|
#define UPDATE_INTERVAL 3600
|
||||||
|
#ifndef SHARED_SECRET
|
||||||
|
#define SHARED_SECRET "empty"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Controller {
|
static std::string readFile(std::string filename){
|
||||||
JSON::Value updates;
|
std::ifstream file(filename.c_str());
|
||||||
|
if (!file.good()){return "";}
|
||||||
|
file.seekg(0, std::ios::end);
|
||||||
|
unsigned int len = file.tellg();
|
||||||
|
file.seekg(0, std::ios::beg);
|
||||||
|
std::string out;
|
||||||
|
out.reserve(len);
|
||||||
|
unsigned int i = 0;
|
||||||
|
while (file.good() && i++ < len){out += file.get();}
|
||||||
|
file.close();
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool writeFile(std::string filename, std::string &contents){
|
||||||
|
unlink(filename.c_str());
|
||||||
|
std::ofstream file(filename.c_str(), std::ios_base::trunc | std::ios_base::out);
|
||||||
|
if (!file.is_open()){return false;}
|
||||||
|
file << contents;
|
||||||
|
file.close();
|
||||||
|
chmod(filename.c_str(), S_IRWXU | S_IRWXG);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
std::string readFile(std::string filename){
|
tthread::mutex updaterMutex;
|
||||||
std::ifstream file(filename.c_str());
|
uint8_t updatePerc = 0;
|
||||||
if ( !file.good()){
|
JSON::Value updates;
|
||||||
return "";
|
|
||||||
|
namespace Controller{
|
||||||
|
|
||||||
|
void updateThread(void *np){
|
||||||
|
uint64_t updateChecker = Util::epoch() - UPDATE_INTERVAL;
|
||||||
|
while (Controller::conf.is_active){
|
||||||
|
if (Util::epoch() - updateChecker > UPDATE_INTERVAL || updatePerc){
|
||||||
|
JSON::Value result = Controller::checkUpdateInfo();
|
||||||
|
if (result.isMember("error")){
|
||||||
|
FAIL_MSG("Error retrieving update information: %s",
|
||||||
|
result["error"].asStringRef().c_str());
|
||||||
|
}
|
||||||
|
{// Lock the mutex, update the updates object
|
||||||
|
tthread::lock_guard<tthread::mutex> guard(updaterMutex);
|
||||||
|
updates = result;
|
||||||
|
}
|
||||||
|
if (!result["uptodate"] && updatePerc){
|
||||||
|
Socket::Connection updrConn("releases.mistserver.org", 80, true);
|
||||||
|
if (!updrConn){
|
||||||
|
FAIL_MSG("Could not connect to releases.mistserver.org for update");
|
||||||
|
}else{
|
||||||
|
// loop through the available components, update them
|
||||||
|
unsigned int needCount = result["needs_update"].size();
|
||||||
|
if (needCount){
|
||||||
|
jsonForEach(result["needs_update"], it){
|
||||||
|
if (!Controller::conf.is_active){break;}
|
||||||
|
updatePerc = ((it.num() * 99) / needCount) + 1;
|
||||||
|
updateComponent(it->asStringRef(), result[it->asStringRef()].asStringRef(),
|
||||||
|
updrConn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updrConn.close();
|
||||||
|
}
|
||||||
|
updatePerc = 0;
|
||||||
|
}
|
||||||
|
updateChecker = Util::epoch();
|
||||||
|
}
|
||||||
|
Util::sleep(3000);
|
||||||
}
|
}
|
||||||
file.seekg(0, std::ios::end);
|
}
|
||||||
unsigned int len = file.tellg();
|
|
||||||
file.seekg(0, std::ios::beg);
|
|
||||||
std::string out;
|
|
||||||
out.reserve(len);
|
|
||||||
unsigned int i = 0;
|
|
||||||
while (file.good() && i++ < len){
|
|
||||||
out += file.get();
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
return out;
|
|
||||||
} //readFile
|
|
||||||
|
|
||||||
bool writeFile(std::string filename, std::string & contents){
|
void insertUpdateInfo(JSON::Value &ret){
|
||||||
unlink(filename.c_str());
|
tthread::lock_guard<tthread::mutex> guard(updaterMutex);
|
||||||
std::ofstream file(filename.c_str(), std::ios_base::trunc | std::ios_base::out);
|
ret = updates;
|
||||||
if ( !file.is_open()){
|
if (updatePerc){ret["progress"] = (long long)updatePerc;}
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
file << contents;
|
|
||||||
file.close();
|
|
||||||
chmod(filename.c_str(), S_IRWXU | S_IRWXG);
|
|
||||||
return true;
|
|
||||||
} //writeFile
|
|
||||||
|
|
||||||
/// \api
|
/// Downloads the latest details on updates
|
||||||
/// `"update"` and `"checkupdate"` requests (LTS-only) are responded to as:
|
JSON::Value checkUpdateInfo(){
|
||||||
/// ~~~~~~~~~~~~~~~{.js}
|
|
||||||
/// {
|
|
||||||
/// "error": "Something went wrong", // 'Optional'
|
|
||||||
/// "release": "LTS64_99",
|
|
||||||
/// "version": "1.2 / 6.0.0",
|
|
||||||
/// "date": "January 5th, 2014",
|
|
||||||
/// "uptodate": 0,
|
|
||||||
/// "needs_update": ["MistBuffer", "MistController"], //Controller is guaranteed to be last
|
|
||||||
/// "MistController": "abcdef1234567890", //md5 sum of latest version
|
|
||||||
/// //... all other MD5 sums follow
|
|
||||||
/// }
|
|
||||||
/// ~~~~~~~~~~~~~~~
|
|
||||||
/// Note that `"update"` will only list known information, while `"checkupdate"` triggers an information refresh from the update server.
|
|
||||||
JSON::Value CheckUpdateInfo(){
|
|
||||||
JSON::Value ret;
|
JSON::Value ret;
|
||||||
|
|
||||||
|
|
||||||
//initialize connection
|
|
||||||
HTTP::Parser http;
|
HTTP::Parser http;
|
||||||
JSON::Value updrInfo;
|
JSON::Value updrInfo;
|
||||||
|
// retrieve update information
|
||||||
Socket::Connection updrConn("releases.mistserver.org", 80, true);
|
Socket::Connection updrConn("releases.mistserver.org", 80, true);
|
||||||
if ( !updrConn){
|
if (!updrConn){
|
||||||
Log("UPDR", "Could not connect to releases.mistserver.org to get update information.");
|
Log("UPDR", "Could not connect to releases.mistserver.org to get update information.");
|
||||||
ret["error"] = "Could not connect to releases.mistserver.org to get update information.";
|
ret["error"] = "Could not connect to releases.mistserver.org to get update information.";
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//retrieve update information
|
|
||||||
http.url = "/getsums.php?verinfo=1&rel=" RELEASE "&pass=" SHARED_SECRET "&iid=" + instanceId;
|
http.url = "/getsums.php?verinfo=1&rel=" RELEASE "&pass=" SHARED_SECRET "&iid=" + instanceId;
|
||||||
http.method = "GET";
|
http.method = "GET";
|
||||||
http.SetHeader("Host", "releases.mistserver.org");
|
http.SetHeader("Host", "releases.mistserver.org");
|
||||||
|
@ -90,22 +115,11 @@ namespace Controller {
|
||||||
http.Clean();
|
http.Clean();
|
||||||
unsigned int startTime = Util::epoch();
|
unsigned int startTime = Util::epoch();
|
||||||
while ((Util::epoch() - startTime < 10) && (updrConn || updrConn.Received().size())){
|
while ((Util::epoch() - startTime < 10) && (updrConn || updrConn.Received().size())){
|
||||||
if (updrConn.spool() || updrConn.Received().size()){
|
if (updrConn.spool() && http.Read(updrConn)){
|
||||||
if ( *(updrConn.Received().get().rbegin()) != '\n'){
|
updrInfo = JSON::fromString(http.body);
|
||||||
std::string tmp = updrConn.Received().get();
|
break; // break out of while loop
|
||||||
updrConn.Received().get().clear();
|
|
||||||
if (updrConn.Received().size()){
|
|
||||||
updrConn.Received().get().insert(0, tmp);
|
|
||||||
}else{
|
|
||||||
updrConn.Received().append(tmp);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (http.Read(updrConn.Received().get())){
|
|
||||||
updrInfo = JSON::fromString(http.body);
|
|
||||||
break; //break out of while loop
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Util::sleep(250);
|
||||||
}
|
}
|
||||||
updrConn.close();
|
updrConn.close();
|
||||||
|
|
||||||
|
@ -117,20 +131,14 @@ namespace Controller {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ret["release"] = RELEASE;
|
ret["release"] = RELEASE;
|
||||||
if (updrInfo.isMember("version")){
|
if (updrInfo.isMember("version")){ret["version"] = updrInfo["version"];}
|
||||||
ret["version"] = updrInfo["version"];
|
if (updrInfo.isMember("date")){ret["date"] = updrInfo["date"];}
|
||||||
}
|
|
||||||
if (updrInfo.isMember("date")){
|
|
||||||
ret["date"] = updrInfo["date"];
|
|
||||||
}
|
|
||||||
ret["uptodate"] = 1;
|
ret["uptodate"] = 1;
|
||||||
ret["needs_update"].null();
|
ret["needs_update"].null();
|
||||||
|
|
||||||
// check if everything is up to date or not
|
// check if everything is up to date or not
|
||||||
jsonForEach(updrInfo, it){
|
jsonForEach(updrInfo, it){
|
||||||
if (it.key().substr(0, 4) != "Mist"){
|
if (it.key().substr(0, 4) != "Mist"){continue;}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ret[it.key()] = *it;
|
ret[it.key()] = *it;
|
||||||
if (it->asString() != Secure::md5(readFile(Util::getMyPath() + it.key()))){
|
if (it->asString() != Secure::md5(readFile(Util::getMyPath() + it.key()))){
|
||||||
ret["uptodate"] = 0;
|
ret["uptodate"] = 0;
|
||||||
|
@ -148,99 +156,63 @@ namespace Controller {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Calls CheckUpdateInfo(), uses the resulting JSON::Value to download any needed updates.
|
/// Causes the updater thread to download an update, if available
|
||||||
/// Will shut down the server if the JSON::Value contained a "shutdown" member.
|
void checkUpdates(){updatePerc = 1;}// CheckUpdates
|
||||||
void CheckUpdates(){
|
|
||||||
JSON::Value updrInfo = CheckUpdateInfo();
|
|
||||||
if (updrInfo.isMember("error")){
|
|
||||||
Log("UPDR", "Error retrieving update information: " + updrInfo["error"].asString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updrInfo.isMember("shutdown")){
|
|
||||||
Log("DDVT", "Shutting down: " + updrInfo["shutdown"].asString());
|
|
||||||
restarting = false;
|
|
||||||
raise(SIGINT); //trigger shutdown
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updrInfo["uptodate"]){
|
|
||||||
//nothing to do
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//initialize connection
|
|
||||||
Socket::Connection updrConn("releases.mistserver.org", 80, true);
|
|
||||||
if ( !updrConn){
|
|
||||||
Log("UPDR", "Could not connect to releases.mistserver.org.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//loop through the available components, update them
|
|
||||||
jsonForEach(updrInfo["needs_update"], it){
|
|
||||||
updateComponent(it->asStringRef(), updrInfo[it->asStringRef()].asStringRef(), updrConn);
|
|
||||||
}
|
|
||||||
updrConn.close();
|
|
||||||
} //CheckUpdates
|
|
||||||
|
|
||||||
/// Attempts to download an update for the listed component.
|
/// Attempts to download an update for the listed component.
|
||||||
/// \param component Filename of the component being checked.
|
/// \param component Filename of the component being checked.
|
||||||
/// \param md5sum The MD5 sum of the latest version of this file.
|
/// \param md5sum The MD5 sum of the latest version of this file.
|
||||||
/// \param updrConn An connection to releases.mistserver.org to (re)use. Will be (re)opened if closed.
|
/// \param updrConn An connection to releases.mistserver.org to (re)use. Will be (re)opened if
|
||||||
void updateComponent(const std::string & component, const std::string & md5sum, Socket::Connection & updrConn){
|
/// closed.
|
||||||
Log("UPDR", "Downloading update for " + component);
|
void updateComponent(const std::string &component, const std::string &md5sum,
|
||||||
|
Socket::Connection &updrConn){
|
||||||
|
Log("UPDR", "Updating " + component);
|
||||||
std::string new_file;
|
std::string new_file;
|
||||||
HTTP::Parser http;
|
HTTP::Parser http;
|
||||||
http.url = "/getfile.php?rel=" RELEASE "&pass=" SHARED_SECRET "&file=" + component;
|
http.url = "/getfile.php?rel=" RELEASE "&pass=" SHARED_SECRET "&file=" + component;
|
||||||
http.method = "GET";
|
http.method = "GET";
|
||||||
http.SetHeader("Host", "releases.mistserver.org");
|
http.SetHeader("Host", "releases.mistserver.org");
|
||||||
if ( !updrConn){
|
http.SetHeader("X-Version", PACKAGE_VERSION);
|
||||||
|
if (!updrConn){
|
||||||
updrConn = Socket::Connection("releases.mistserver.org", 80, true);
|
updrConn = Socket::Connection("releases.mistserver.org", 80, true);
|
||||||
if ( !updrConn){
|
if (!updrConn){
|
||||||
Log("UPDR", "Could not connect to releases.mistserver.org for file download.");
|
FAIL_MSG("Could not connect to releases.mistserver.org for file download.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
http.SendRequest(updrConn);
|
http.SendRequest(updrConn);
|
||||||
http.Clean();
|
http.Clean();
|
||||||
unsigned int startTime = Util::epoch();
|
uint64_t startTime = Util::bootSecs();
|
||||||
while ((Util::epoch() - startTime < 90) && (updrConn || updrConn.Received().size())){
|
while ((Util::bootSecs() < startTime + 10) && updrConn && Controller::conf.is_active){
|
||||||
if (updrConn.spool() || updrConn.Received().size()){
|
if (!updrConn.spool()){
|
||||||
if ( *(updrConn.Received().get().rbegin()) != '\n'){
|
Util::sleep(250);
|
||||||
std::string tmp = updrConn.Received().get();
|
continue;
|
||||||
updrConn.Received().get().clear();
|
|
||||||
if (updrConn.Received().size()){
|
|
||||||
updrConn.Received().get().insert(0, tmp);
|
|
||||||
}else{
|
|
||||||
updrConn.Received().append(tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (http.Read(updrConn.Received().get())){
|
|
||||||
new_file = http.body;
|
|
||||||
break; //break out of while loop
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (http.Read(updrConn)){
|
||||||
|
new_file = http.body;
|
||||||
|
break; // break out of while loop
|
||||||
|
}
|
||||||
|
startTime = Util::bootSecs();
|
||||||
}
|
}
|
||||||
http.Clean();
|
http.Clean();
|
||||||
if (new_file == ""){
|
if (new_file == ""){
|
||||||
Log("UPDR", "Could not retrieve new version of " + component + " - retrying next time.");
|
FAIL_MSG("Could not retrieve new version of %s, continuing without", component.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Secure::md5(new_file) != md5sum){
|
if (Secure::md5(new_file) != md5sum){
|
||||||
Log("UPDR", "Checksum "+Secure::md5(new_file)+" of " + component + " does not match "+md5sum+" - retrying next time.");
|
FAIL_MSG("Checksum of %s incorrect, continuing without", component.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (writeFile(Util::getMyPath() + component, new_file)){
|
if (!writeFile(Util::getMyPath() + component, new_file)){
|
||||||
Controller::UpdateProtocol(component);
|
FAIL_MSG("Could not write updated version of %s, continuing without", component.c_str());
|
||||||
if (component == "MistController"){
|
return;
|
||||||
restarting = true;
|
|
||||||
raise(SIGINT); //trigger restart
|
|
||||||
}
|
|
||||||
Log("UPDR", "New version of " + component + " installed.");
|
|
||||||
}else{
|
|
||||||
Log("UPDR", component + " could not be updated! (No write access to file?)");
|
|
||||||
}
|
}
|
||||||
|
Controller::UpdateProtocol(component);
|
||||||
|
if (component == "MistController"){
|
||||||
|
restarting = true;
|
||||||
|
raise(SIGINT); // trigger restart
|
||||||
|
}
|
||||||
|
Log("UPDR", "New version of " + component + " installed.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} //Controller namespace
|
|
||||||
|
|
|
@ -1,19 +1,16 @@
|
||||||
/// \file controller_updater.cpp
|
/// \file controller_updater.h
|
||||||
/// Contains all code for the controller updater.
|
/// Contains all code for the controller updater.
|
||||||
|
|
||||||
|
#include <mist/json.h>
|
||||||
|
#include <mist/socket.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifndef SHARED_SECRET
|
namespace Controller{
|
||||||
#define SHARED_SECRET "empty"
|
void updateThread(void *np);
|
||||||
#endif
|
JSON::Value checkUpdateInfo();
|
||||||
|
void checkUpdates();
|
||||||
|
void insertUpdateInfo(JSON::Value &ret);
|
||||||
|
void updateComponent(const std::string &component, const std::string &md5sum,
|
||||||
|
Socket::Connection &updrConn);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Controller {
|
|
||||||
extern JSON::Value updates;
|
|
||||||
|
|
||||||
std::string readFile(std::string filename);
|
|
||||||
bool writeFile(std::string filename, std::string & contents);
|
|
||||||
JSON::Value CheckUpdateInfo();
|
|
||||||
void CheckUpdates();
|
|
||||||
void updateComponent(const std::string & component, const std::string & md5sum, Socket::Connection & updrConn);
|
|
||||||
|
|
||||||
} //Controller namespace
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue