mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-03-30 07:20:52 +00:00
Remove use shutdown signal inside init function
This commit is contained in:
parent
1afd1b7c94
commit
e53f65c305
@ -36,7 +36,7 @@ bool user_creds_exist(const std::string &file);
|
||||
std::string unique_id;
|
||||
net::net_e origin_pin_allowed;
|
||||
|
||||
void init(std::shared_ptr<safe::signal_t> shutdown_event) {
|
||||
int init() {
|
||||
bool clean_slate = config::sunshine.flags[config::flag::FRESH_STATE];
|
||||
origin_pin_allowed = net::from_enum_string(config::nvhttp.origin_pin_allowed);
|
||||
if(clean_slate) {
|
||||
@ -48,20 +48,19 @@ void init(std::shared_ptr<safe::signal_t> shutdown_event) {
|
||||
|
||||
if(!fs::exists(config::nvhttp.pkey) || !fs::exists(config::nvhttp.cert)) {
|
||||
if(create_creds(config::nvhttp.pkey, config::nvhttp.cert)) {
|
||||
shutdown_event->raise(true);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if(!user_creds_exist(config::sunshine.credentials_file)) {
|
||||
if(save_user_creds(config::sunshine.credentials_file, "sunshine"s, crypto::rand_alphabet(16), true)) {
|
||||
shutdown_event->raise(true);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if(reload_user_creds(config::sunshine.credentials_file)) {
|
||||
shutdown_event->raise(true);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int save_user_creds(const std::string &file, const std::string &username, const std::string &password, bool run_our_mouth) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
namespace http {
|
||||
|
||||
void init(std::shared_ptr<safe::signal_t> shutdown_event);
|
||||
int init();
|
||||
int create_creds(const std::string &pkey, const std::string &cert);
|
||||
int save_user_creds(
|
||||
const std::string &file,
|
||||
|
@ -196,7 +196,10 @@ int main(int argc, char *argv[]) {
|
||||
if(video::init()) {
|
||||
return 2;
|
||||
}
|
||||
http::init(shutdown_event);
|
||||
if(http::init()) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
task_pool.start(1);
|
||||
|
||||
std::thread httpThread { nvhttp::start, shutdown_event };
|
||||
|
Loading…
x
Reference in New Issue
Block a user