fixed calling terminate instead of gracefully ending

This commit is contained in:
loki
2021-06-08 21:58:32 +02:00
parent 0942f2ee7f
commit c53564dd31
3 changed files with 16 additions and 9 deletions
+7 -7
View File
@@ -2,9 +2,9 @@
#include <filesystem> #include <filesystem>
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp> #include <boost/property_tree/xml_parser.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/asio/ssl/context.hpp> #include <boost/asio/ssl/context.hpp>
@@ -13,15 +13,15 @@
#include <boost/asio/ssl/context_base.hpp> #include <boost/asio/ssl/context_base.hpp>
#include "config.h" #include "config.h"
#include "utility.h"
#include "rtsp.h"
#include "crypto.h" #include "crypto.h"
#include "httpcommon.h"
#include "main.h"
#include "network.h"
#include "nvhttp.h" #include "nvhttp.h"
#include "platform/common.h" #include "platform/common.h"
#include "network.h" #include "rtsp.h"
#include "utility.h"
#include "uuid.h" #include "uuid.h"
#include "main.h"
#include "httpcommon.h"
namespace http { namespace http {
using namespace std::literals; using namespace std::literals;
@@ -73,7 +73,7 @@ int generate_user_creds(const std::string &file) {
outputTree.put("username", "sunshine"); outputTree.put("username", "sunshine");
outputTree.put("salt", salt); outputTree.put("salt", salt);
outputTree.put("password", util::hex(crypto::hash(plainPassword + salt)).to_string()); outputTree.put("password", util::hex(crypto::hash(plainPassword + salt)).to_string());
BOOST_LOG(info) << "New credentials has been created"; BOOST_LOG(info) << "New credentials have been created";
BOOST_LOG(info) << "Username: " << username; BOOST_LOG(info) << "Username: " << username;
BOOST_LOG(info) << "Password: " << plainPassword; BOOST_LOG(info) << "Password: " << plainPassword;
pt::write_json(file, outputTree); pt::write_json(file, outputTree);
+4
View File
@@ -1,5 +1,8 @@
#include "network.h" #include "network.h"
#include "thread_safe.h"
namespace http { namespace http {
void init(std::shared_ptr<safe::signal_t> shutdown_event); void init(std::shared_ptr<safe::signal_t> shutdown_event);
int create_creds(const std::string &pkey, const std::string &cert); int create_creds(const std::string &pkey, const std::string &cert);
std::string read_file(const char *path); std::string read_file(const char *path);
@@ -7,4 +10,5 @@ int write_file(const char *path, const std::string_view &contents);
int reload_user_creds(const std::string &file); int reload_user_creds(const std::string &file);
extern std::string unique_id; extern std::string unique_id;
extern net::net_e origin_pin_allowed; extern net::net_e origin_pin_allowed;
} // namespace http } // namespace http
+5 -2
View File
@@ -15,9 +15,9 @@
#include <boost/log/sources/severity_logger.hpp> #include <boost/log/sources/severity_logger.hpp>
#include "config.h" #include "config.h"
#include "nvhttp.h"
#include "httpcommon.h"
#include "confighttp.h" #include "confighttp.h"
#include "httpcommon.h"
#include "nvhttp.h"
#include "rtsp.h" #include "rtsp.h"
#include "thread_pool.h" #include "thread_pool.h"
#include "video.h" #include "video.h"
@@ -142,7 +142,10 @@ int main(int argc, char *argv[]) {
std::thread httpThread { nvhttp::start, shutdown_event }; std::thread httpThread { nvhttp::start, shutdown_event };
std::thread configThread { confighttp::start, shutdown_event }; std::thread configThread { confighttp::start, shutdown_event };
stream::rtpThread(shutdown_event); stream::rtpThread(shutdown_event);
httpThread.join(); httpThread.join();
configThread.join();
task_pool.stop(); task_pool.stop();
task_pool.join(); task_pool.join();