Fix controller segfault on using fillActive function during stats update.
This commit is contained in:
parent
324d29fb0c
commit
f010dcd0f7
1 changed files with 9 additions and 6 deletions
|
@ -910,12 +910,15 @@ void Controller::fillActive(JSON::Value & req, JSON::Value & rep, bool onlyNow){
|
||||||
std::map<std::string, unsigned long> clients;
|
std::map<std::string, unsigned long> clients;
|
||||||
unsigned int t = Util::epoch() - STATS_DELAY;
|
unsigned int t = Util::epoch() - STATS_DELAY;
|
||||||
//check all sessions
|
//check all sessions
|
||||||
if (sessions.size()){
|
{
|
||||||
for (std::map<sessIndex, statSession>::iterator it = sessions.begin(); it != sessions.end(); it++){
|
tthread::lock_guard<tthread::mutex> guard(statsMutex);
|
||||||
if (!onlyNow || (it->second.hasDataFor(t) && it->second.isViewerOn(t))){
|
if (sessions.size()){
|
||||||
streams.insert(it->first.streamName);
|
for (std::map<sessIndex, statSession>::iterator it = sessions.begin(); it != sessions.end(); it++){
|
||||||
if (it->second.getSessType() == SESS_VIEWER){
|
if (!onlyNow || (it->second.hasDataFor(t) && it->second.isViewerOn(t))){
|
||||||
clients[it->first.streamName]++;
|
streams.insert(it->first.streamName);
|
||||||
|
if (it->second.getSessType() == SESS_VIEWER){
|
||||||
|
clients[it->first.streamName]++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue