Fix potential failure in MySQL CM and fix describe method

This commit is contained in:
Brendan LE GLAUNEC
2016-08-31 12:46:21 +02:00
committed by Brendan Le Glaunec
parent d9945f5e26
commit 34351ae14e
4 changed files with 7 additions and 3 deletions
@@ -158,7 +158,7 @@ mysql_cache_manager::set_streams(std::vector<etix::cameradar::stream_model> mode
// TODO : Update an entry if it already exists.
if (result.data->next()) return;
if (result.data->next()) continue;
query = tool::fmt(this->insert_with_id_query,
this->connection.get_db_name().c_str(),
+1
View File
@@ -75,6 +75,7 @@ curl_describe(const std::string& path, bool logs) {
if (logs) {
// Some cameras return 400 instead of 401, don't know why.
// Some cameras timeout and then curl considers the status as 0
// GST-RTSP-SERVER returns 404 instead of 401, then 401 instead of 404.
if (rc != 401 && rc != 400 && rc && pos == std::string::npos)
LOG_INFO_("Unprotected camera discovered.", "brutelogs");
return ((res == CURLE_OK) && rc != 401 && rc != 400 && rc);
+4 -1
View File
@@ -17,6 +17,8 @@
namespace etix {
namespace cameradar {
using namespace std::chrono_literals;
// The main loop of the binary
void
dispatcher::run() {
@@ -47,7 +49,7 @@ dispatcher::run() {
// Waiting for task to cleanup / force stop command
while ((signal_handler::instance().should_stop() not_eq stop_priority::force_stop) and
doing_stuff()) {
std::this_thread::sleep_for(std::chrono::milliseconds(30));
std::this_thread::sleep_for(30ms);
}
worker.join();
}
@@ -88,6 +90,7 @@ dispatcher::do_stuff() {
"dispatcher");
break;
}
std::this_thread::sleep_for(30ms);
}
this->current = task::finished;
}
+1 -1
View File
@@ -124,7 +124,7 @@ main(int argc, char* argv[]) {
auto plug = std::make_shared<etix::cameradar::cache_manager>(conf.second.cache_manager_path,
conf.second.cache_manager_name);
if (not plug->make_instance()) {
if (not plug || not plug->make_instance()) {
LOG_ERR_(std::string("Invalid cache manager "), "cameradar");
return false;
}