Fix controller deadlock.

This commit is contained in:
Thulinma 2016-05-28 13:45:19 +02:00
parent f010dcd0f7
commit 1d950f31ba

View file

@ -126,7 +126,6 @@ void Controller::killStatistics(char * data, size_t len, unsigned int id){
///This function is ran whenever a stream becomes active. ///This function is ran whenever a stream becomes active.
void Controller::streamStarted(std::string stream){ void Controller::streamStarted(std::string stream){
tthread::lock_guard<tthread::mutex> guard(Controller::configMutex);
INFO_MSG("Stream %s became active", stream.c_str()); INFO_MSG("Stream %s became active", stream.c_str());
Controller::doAutoPush(stream); Controller::doAutoPush(stream);
} }
@ -177,7 +176,8 @@ void Controller::SharedMemStats(void * config){
std::set<std::string> inactiveStreams; std::set<std::string> inactiveStreams;
while(((Util::Config*)config)->is_active){ while(((Util::Config*)config)->is_active){
{ {
tthread::lock_guard<tthread::mutex> guard(statsMutex); tthread::lock_guard<tthread::mutex> guard(Controller::configMutex);
tthread::lock_guard<tthread::mutex> guard2(statsMutex);
//parse current users //parse current users
statServer.parseEach(parseStatistics); statServer.parseEach(parseStatistics);
//wipe old statistics //wipe old statistics