Merge branch 'development' into LTS_development
# Conflicts: # src/controller/controller.cpp
This commit is contained in:
commit
eb6b98b219
3 changed files with 29 additions and 10 deletions
|
@ -301,16 +301,18 @@ int main(int argc, char ** argv){
|
||||||
//start main loop
|
//start main loop
|
||||||
Controller::conf.serveThreadedSocket(Controller::handleAPIConnection);
|
Controller::conf.serveThreadedSocket(Controller::handleAPIConnection);
|
||||||
//print shutdown reason
|
//print shutdown reason
|
||||||
|
std::string shutdown_reason;
|
||||||
|
if (!Controller::conf.is_active){
|
||||||
|
shutdown_reason = "user request (received shutdown signal)";
|
||||||
|
}else{
|
||||||
|
shutdown_reason = "socket problem (API port closed)";
|
||||||
|
}
|
||||||
/*LTS-START*/
|
/*LTS-START*/
|
||||||
if (Controller::restarting){
|
if (Controller::restarting){
|
||||||
Controller::Log("CONF", "Controller restarting for update");
|
shutdown_reason = "update (on request)";
|
||||||
}
|
}
|
||||||
/*LTS-END*/
|
/*LTS-END*/
|
||||||
if (!Controller::conf.is_active){
|
Controller::Log("CONF", "Controller shutting down because of "+shutdown_reason);
|
||||||
Controller::Log("CONF", "Controller shutting down because of user request (received shutdown signal)");
|
|
||||||
}else{
|
|
||||||
Controller::Log("CONF", "Controller shutting down because of socket problem (API port closed)");
|
|
||||||
}
|
|
||||||
Controller::conf.is_active = false;
|
Controller::conf.is_active = false;
|
||||||
//join all joinable threads
|
//join all joinable threads
|
||||||
statsThread.join();
|
statsThread.join();
|
||||||
|
|
|
@ -76,10 +76,24 @@ namespace Controller {
|
||||||
|
|
||||||
/// Writes the current config to shared memory to be used in other processes
|
/// Writes the current config to shared memory to be used in other processes
|
||||||
void writeConfig(){
|
void writeConfig(){
|
||||||
JSON::Value writeConf;
|
static JSON::Value writeConf;
|
||||||
writeConf["config"] = Storage["config"];
|
bool changed = false;
|
||||||
writeConf["streams"] = Storage["streams"];
|
if (writeConf["config"] != Storage["config"]){
|
||||||
writeConf["capabilities"] = capabilities;
|
writeConf["config"] = Storage["config"];
|
||||||
|
VERYHIGH_MSG("Saving new config because of edit in server config structure");
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
if (writeConf["streams"] != Storage["streams"]){
|
||||||
|
writeConf["streams"] = Storage["streams"];
|
||||||
|
VERYHIGH_MSG("Saving new config because of edit in streams");
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
if (writeConf["capabilities"] != capabilities){
|
||||||
|
writeConf["capabilities"] = capabilities;
|
||||||
|
VERYHIGH_MSG("Saving new config because of edit in capabilities");
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
if (!changed){return;}//cancel further processing if no changes
|
||||||
|
|
||||||
static IPC::sharedPage mistConfOut("!mistConfig", DEFAULT_CONF_PAGE_SIZE, true);
|
static IPC::sharedPage mistConfOut("!mistConfig", DEFAULT_CONF_PAGE_SIZE, true);
|
||||||
IPC::semaphore configLock("!mistConfLock", O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
IPC::semaphore configLock("!mistConfLock", O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||||
|
|
|
@ -96,6 +96,9 @@ namespace Mist {
|
||||||
/// thus causing the process to exit cleanly.
|
/// thus causing the process to exit cleanly.
|
||||||
void Output::onFail(){
|
void Output::onFail(){
|
||||||
isInitialized = false;
|
isInitialized = false;
|
||||||
|
wantRequest = true;
|
||||||
|
parseData= false;
|
||||||
|
streamName.clear();
|
||||||
myConn.close();
|
myConn.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue