void DocumentPlugin scanner auto ppol policies begin if ppol policies

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
void DocumentPlugin::scanner() {
auto ppol = policies.begin();
if (ppol == policies.end()) {
writeLog(MessageType::General, "No policies enabled, cancelling scan.");
return;
}
writeLog(MessageType::General, "Starting scanning...");
while (!isStopping())
try {
scan(*ppol);
++ppol;
if (ppol == policies.end())
ppol = policies.begin();
if (isStopping())
break;
sleep(120);
} catch (std::exception& e) {
report_exception(e, "Scanning with policy %d:%s", ppol->policy_id, ppol->guid);
}
}