Semaphore fixes.
This commit is contained in:
parent
9498f87cc3
commit
df16c815c2
5 changed files with 21 additions and 17 deletions
|
@ -127,8 +127,9 @@ void statusMonitor(void * np){
|
|||
changed = true;
|
||||
}
|
||||
configLock.post();
|
||||
if (changed){
|
||||
if (changed || Controller::configChanged){
|
||||
Controller::writeConfig();
|
||||
Controller::configChanged = false;
|
||||
}
|
||||
}
|
||||
Util::wait(5000);//wait at least 5 seconds
|
||||
|
|
|
@ -572,7 +572,7 @@ int Controller::handleAPIConnection(Socket::Connection & conn){
|
|||
Controller::fillActive(Request["stats_streams"], Response["stats_streams"]);
|
||||
}
|
||||
|
||||
Controller::writeConfig();
|
||||
Controller::configChanged = true;
|
||||
|
||||
}else{//unauthorized
|
||||
Util::sleep(1000);//sleep a second to prevent bruteforcing
|
||||
|
|
|
@ -16,6 +16,8 @@ namespace Controller {
|
|||
JSON::Value Storage; ///< Global storage of data.
|
||||
tthread::mutex configMutex;
|
||||
tthread::mutex logMutex;
|
||||
bool configChanged = false;
|
||||
|
||||
///\brief Store and print a log message.
|
||||
///\param kind The type of message.
|
||||
///\param message The message to be logged.
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace Controller {
|
|||
extern JSON::Value Storage; ///< Global storage of data.
|
||||
extern tthread::mutex logMutex;///< Mutex for log thread.
|
||||
extern tthread::mutex configMutex;///< Mutex for server config access.
|
||||
extern bool configChanged; ///< Bool that indicates config must be written to SHM.
|
||||
|
||||
/// Store and print a log message.
|
||||
void Log(std::string kind, std::string message);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue