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);
|
||||
|
|
|
@ -951,24 +951,24 @@ namespace Mist {
|
|||
{
|
||||
|
||||
// @todo check if output is already running ?
|
||||
if (recordingPid == -1
|
||||
&& config != NULL
|
||||
)
|
||||
{
|
||||
if (recordingPid == -1 && config != NULL){
|
||||
configLock.post();
|
||||
configLock.close();
|
||||
|
||||
INFO_MSG("The stream %s has a value specified for the recording. "
|
||||
"We're goint to start an output and record into %s",
|
||||
config->getString("streamname").c_str(),
|
||||
streamCfg.getMember("record").asString().c_str());
|
||||
INFO_MSG("The stream %s has a value specified for the recording. "
|
||||
"We're going to start an output and record into %s",
|
||||
config->getString("streamname").c_str(),
|
||||
streamCfg.getMember("record").asString().c_str());
|
||||
|
||||
recordingPid = Util::startRecording(config->getString("streamname"));
|
||||
if (recordingPid < 0) {
|
||||
FAIL_MSG("Failed to start the recording for %s", config->getString("streamname").c_str());
|
||||
// @todo shouldn't we do configList.post(), configLock.close() and return false?
|
||||
// @todo discuss with Jaron. 2015.09.26, remove this comment when discussed.
|
||||
}
|
||||
INFO_MSG("We started an output for recording with PID: %d", recordingPid);
|
||||
recordingPid = Util::startRecording(config->getString("streamname"));
|
||||
if (recordingPid < 0) {
|
||||
FAIL_MSG("Failed to start the recording for %s", config->getString("streamname").c_str());
|
||||
// @todo shouldn't we do configList.post(), configLock.close() and return false?
|
||||
// @todo discuss with Jaron. 2015.09.26, remove this comment when discussed.
|
||||
}
|
||||
INFO_MSG("We started an output for recording with PID: %d", recordingPid);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/* roxlu-end */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue