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;
|
changed = true;
|
||||||
}
|
}
|
||||||
configLock.post();
|
configLock.post();
|
||||||
if (changed){
|
if (changed || Controller::configChanged){
|
||||||
Controller::writeConfig();
|
Controller::writeConfig();
|
||||||
|
Controller::configChanged = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Util::wait(5000);//wait at least 5 seconds
|
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::fillActive(Request["stats_streams"], Response["stats_streams"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller::writeConfig();
|
Controller::configChanged = true;
|
||||||
|
|
||||||
}else{//unauthorized
|
}else{//unauthorized
|
||||||
Util::sleep(1000);//sleep a second to prevent bruteforcing
|
Util::sleep(1000);//sleep a second to prevent bruteforcing
|
||||||
|
|
|
@ -16,6 +16,8 @@ namespace Controller {
|
||||||
JSON::Value Storage; ///< Global storage of data.
|
JSON::Value Storage; ///< Global storage of data.
|
||||||
tthread::mutex configMutex;
|
tthread::mutex configMutex;
|
||||||
tthread::mutex logMutex;
|
tthread::mutex logMutex;
|
||||||
|
bool configChanged = false;
|
||||||
|
|
||||||
///\brief Store and print a log message.
|
///\brief Store and print a log message.
|
||||||
///\param kind The type of message.
|
///\param kind The type of message.
|
||||||
///\param message The message to be logged.
|
///\param message The message to be logged.
|
||||||
|
|
|
@ -8,6 +8,7 @@ namespace Controller {
|
||||||
extern JSON::Value Storage; ///< Global storage of data.
|
extern JSON::Value Storage; ///< Global storage of data.
|
||||||
extern tthread::mutex logMutex;///< Mutex for log thread.
|
extern tthread::mutex logMutex;///< Mutex for log thread.
|
||||||
extern tthread::mutex configMutex;///< Mutex for server config access.
|
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.
|
/// Store and print a log message.
|
||||||
void Log(std::string kind, std::string message);
|
void Log(std::string kind, std::string message);
|
||||||
|
|
|
@ -951,13 +951,12 @@ namespace Mist {
|
||||||
{
|
{
|
||||||
|
|
||||||
// @todo check if output is already running ?
|
// @todo check if output is already running ?
|
||||||
if (recordingPid == -1
|
if (recordingPid == -1 && config != NULL){
|
||||||
&& config != NULL
|
configLock.post();
|
||||||
)
|
configLock.close();
|
||||||
{
|
|
||||||
|
|
||||||
INFO_MSG("The stream %s has a value specified for the recording. "
|
INFO_MSG("The stream %s has a value specified for the recording. "
|
||||||
"We're goint to start an output and record into %s",
|
"We're going to start an output and record into %s",
|
||||||
config->getString("streamname").c_str(),
|
config->getString("streamname").c_str(),
|
||||||
streamCfg.getMember("record").asString().c_str());
|
streamCfg.getMember("record").asString().c_str());
|
||||||
|
|
||||||
|
@ -968,6 +967,7 @@ namespace Mist {
|
||||||
// @todo discuss with Jaron. 2015.09.26, remove this comment when discussed.
|
// @todo discuss with Jaron. 2015.09.26, remove this comment when discussed.
|
||||||
}
|
}
|
||||||
INFO_MSG("We started an output for recording with PID: %d", recordingPid);
|
INFO_MSG("We started an output for recording with PID: %d", recordingPid);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* roxlu-end */
|
/* roxlu-end */
|
||||||
|
|
Loading…
Add table
Reference in a new issue