Fixed ERROR message when force-saving connector list to shared memory.

This commit is contained in:
Thulinma 2019-05-22 15:16:38 +02:00
parent 8d17d5f6c4
commit 42da518d5f
2 changed files with 11 additions and 5 deletions

View file

@ -23,11 +23,17 @@ namespace Controller {
static std::map<std::string, pid_t> currentConnectors; ///<The currently running connectors. static std::map<std::string, pid_t> currentConnectors; ///<The currently running connectors.
/// Updates the shared memory page with active connectors /// Updates the shared memory page with active connectors
void saveActiveConnectors(){ void saveActiveConnectors(bool forceOverride){
IPC::sharedPage f("MstCnns", 4096, true, false); IPC::sharedPage f("MstCnns", 4096, forceOverride, false);
if (!f.mapped){ if (!f.mapped){
FAIL_MSG("Could not store connector data!"); if (!forceOverride){
return; saveActiveConnectors(true);
return;
}
if (!f.mapped){
FAIL_MSG("Could not store connector data!");
return;
}
} }
memset(f.mapped, 0, 32); memset(f.mapped, 0, 32);
Util::RelAccX A(f.mapped, false); Util::RelAccX A(f.mapped, false);

View file

@ -9,7 +9,7 @@ namespace Controller {
bool CheckProtocols(JSON::Value & p, const JSON::Value & capabilities); bool CheckProtocols(JSON::Value & p, const JSON::Value & capabilities);
/// Updates the shared memory page with active connectors /// Updates the shared memory page with active connectors
void saveActiveConnectors(); void saveActiveConnectors(bool forceOverride = false);
/// Reads active connectors from the shared memory pages /// Reads active connectors from the shared memory pages
void loadActiveConnectors(); void loadActiveConnectors();