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

View File

@ -2,9 +2,9 @@
#include <filesystem>
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/asio/ssl/context.hpp>
@ -13,15 +13,15 @@
#include <boost/asio/ssl/context_base.hpp>
#include "config.h"
#include "utility.h"
#include "rtsp.h"
#include "crypto.h"
#include "httpcommon.h"
#include "main.h"
#include "network.h"
#include "nvhttp.h"
#include "platform/common.h"
#include "network.h"
#include "rtsp.h"
#include "utility.h"
#include "uuid.h"
#include "main.h"
#include "httpcommon.h"
namespace http {
using namespace std::literals;
@ -73,7 +73,7 @@ int generate_user_creds(const std::string &file) {
outputTree.put("username", "sunshine");
outputTree.put("salt", salt);
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) << "Password: " << plainPassword;
pt::write_json(file, outputTree);

View File

@ -1,5 +1,8 @@
#include "network.h"
#include "thread_safe.h"
namespace http {
void init(std::shared_ptr<safe::signal_t> shutdown_event);
int create_creds(const std::string &pkey, const std::string &cert);
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);
extern std::string unique_id;
extern net::net_e origin_pin_allowed;
} // namespace http

View File

@ -15,9 +15,9 @@
#include <boost/log/sources/severity_logger.hpp>
#include "config.h"
#include "nvhttp.h"
#include "httpcommon.h"
#include "confighttp.h"
#include "httpcommon.h"
#include "nvhttp.h"
#include "rtsp.h"
#include "thread_pool.h"
#include "video.h"
@ -142,7 +142,10 @@ int main(int argc, char *argv[]) {
std::thread httpThread { nvhttp::start, shutdown_event };
std::thread configThread { confighttp::start, shutdown_event };
stream::rtpThread(shutdown_event);
httpThread.join();
configThread.join();
task_pool.stop();
task_pool.join();