diff --git a/sunshine/httpcommon.cpp b/sunshine/httpcommon.cpp index 825ae3d6..1eb36924 100644 --- a/sunshine/httpcommon.cpp +++ b/sunshine/httpcommon.cpp @@ -2,9 +2,9 @@ #include +#include #include #include -#include #include @@ -13,15 +13,15 @@ #include #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); diff --git a/sunshine/httpcommon.h b/sunshine/httpcommon.h index 7c441a7c..150298e8 100644 --- a/sunshine/httpcommon.h +++ b/sunshine/httpcommon.h @@ -1,5 +1,8 @@ #include "network.h" +#include "thread_safe.h" + namespace http { + void init(std::shared_ptr 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 \ No newline at end of file diff --git a/sunshine/main.cpp b/sunshine/main.cpp index 70301297..ac6535ae 100644 --- a/sunshine/main.cpp +++ b/sunshine/main.cpp @@ -15,9 +15,9 @@ #include #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();