add sleeping when no viewers and in ondemand mode
This commit is contained in:
parent
8c8a9ca32a
commit
a250567e74
10
src/zmc.cpp
10
src/zmc.cpp
|
@ -250,9 +250,12 @@ int main(int argc, char *argv[]) {
|
|||
monitor->Id());
|
||||
zmDbDo(sql);
|
||||
|
||||
while ((monitor->Capturing() == Monitor::CAPTURING_ONDEMAND) and !monitor->hasViewers()) {
|
||||
|
||||
if (monitor->Capturing() == Monitor::CAPTURING_ONDEMAND) {
|
||||
while (!zm_terminate and !monitor->hasViewers()) {
|
||||
Debug(1, "ONDEMAND and no Viewers. Sleeping");
|
||||
sleep(1);
|
||||
std::this_thread::sleep_for(Seconds(1));
|
||||
}
|
||||
}
|
||||
|
||||
Seconds sleep_time = Seconds(0);
|
||||
|
@ -295,7 +298,8 @@ int main(int argc, char *argv[]) {
|
|||
for (size_t i = 0; i < monitors.size(); i++) {
|
||||
monitors[i]->CheckAction();
|
||||
|
||||
if (monitors[i]->Capturing() == Monitor::CAPTURING_ONDEMAND and !monitors[i]->hasViewers()) {
|
||||
if ((monitors[i]->Capturing() == Monitor::CAPTURING_ONDEMAND) and !monitors[i]->hasViewers()) {
|
||||
std::this_thread::sleep_for(Microseconds(100000));
|
||||
result = 0;
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue