v1.0.5 : Fixed a potential failure in MySQL CM and fixed code
This commit is contained in:
@@ -158,7 +158,7 @@ mysql_cache_manager::set_streams(std::vector<etix::cameradar::stream_model> mode
|
|||||||
|
|
||||||
// TODO : Update an entry if it already exists.
|
// 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,
|
query = tool::fmt(this->insert_with_id_query,
|
||||||
this->connection.get_db_name().c_str(),
|
this->connection.get_db_name().c_str(),
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ curl_describe(const std::string& path, bool logs) {
|
|||||||
if (logs) {
|
if (logs) {
|
||||||
// Some cameras return 400 instead of 401, don't know why.
|
// Some cameras return 400 instead of 401, don't know why.
|
||||||
// Some cameras timeout and then curl considers the status as 0
|
// 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)
|
if (rc != 401 && rc != 400 && rc && pos == std::string::npos)
|
||||||
LOG_INFO_("Unprotected camera discovered.", "brutelogs");
|
LOG_INFO_("Unprotected camera discovered.", "brutelogs");
|
||||||
return ((res == CURLE_OK) && rc != 401 && rc != 400 && rc);
|
return ((res == CURLE_OK) && rc != 401 && rc != 400 && rc);
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
namespace etix {
|
namespace etix {
|
||||||
namespace cameradar {
|
namespace cameradar {
|
||||||
|
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
// The main loop of the binary
|
// The main loop of the binary
|
||||||
void
|
void
|
||||||
dispatcher::run() {
|
dispatcher::run() {
|
||||||
@@ -47,7 +49,7 @@ dispatcher::run() {
|
|||||||
// Waiting for task to cleanup / force stop command
|
// Waiting for task to cleanup / force stop command
|
||||||
while ((signal_handler::instance().should_stop() not_eq stop_priority::force_stop) and
|
while ((signal_handler::instance().should_stop() not_eq stop_priority::force_stop) and
|
||||||
doing_stuff()) {
|
doing_stuff()) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(30));
|
std::this_thread::sleep_for(30ms);
|
||||||
}
|
}
|
||||||
worker.join();
|
worker.join();
|
||||||
}
|
}
|
||||||
@@ -88,6 +90,7 @@ dispatcher::do_stuff() {
|
|||||||
"dispatcher");
|
"dispatcher");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
std::this_thread::sleep_for(30ms);
|
||||||
}
|
}
|
||||||
this->current = task::finished;
|
this->current = task::finished;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ main(int argc, char* argv[]) {
|
|||||||
auto plug = std::make_shared<etix::cameradar::cache_manager>(conf.second.cache_manager_path,
|
auto plug = std::make_shared<etix::cameradar::cache_manager>(conf.second.cache_manager_path,
|
||||||
conf.second.cache_manager_name);
|
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");
|
LOG_ERR_(std::string("Invalid cache manager "), "cameradar");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user