|
|
|
@ -83,7 +83,7 @@ resolvePath(std::string conffname)
|
|
|
|
|
|
|
|
|
|
/// this sets up, configures and runs the main context
|
|
|
|
|
static void
|
|
|
|
|
run_main_context(std::string conffname, bool multiThreaded, bool debugMode)
|
|
|
|
|
run_main_context(std::string conffname, bool multiThreaded, bool backgroundMode)
|
|
|
|
|
{
|
|
|
|
|
// this is important, can downgrade from Info though
|
|
|
|
|
llarp::LogDebug("Running from: ", fs::current_path().string());
|
|
|
|
@ -97,10 +97,10 @@ run_main_context(std::string conffname, bool multiThreaded, bool debugMode)
|
|
|
|
|
#ifndef _WIN32
|
|
|
|
|
signal(SIGHUP, handle_signal);
|
|
|
|
|
#endif
|
|
|
|
|
code = llarp_main_setup(ctx, debugMode);
|
|
|
|
|
code = llarp_main_setup(ctx);
|
|
|
|
|
llarp::util::SetThreadName("llarp-mainloop");
|
|
|
|
|
if(code == 0)
|
|
|
|
|
code = llarp_main_run(ctx);
|
|
|
|
|
code = llarp_main_run(ctx, backgroundMode);
|
|
|
|
|
llarp_main_free(ctx);
|
|
|
|
|
}
|
|
|
|
|
exit_code.set_value(code);
|
|
|
|
@ -140,16 +140,16 @@ main(int argc, char *argv[])
|
|
|
|
|
("r,router", "generate router config", cxxopts::value<bool>())
|
|
|
|
|
("f,force", "overwrite", cxxopts::value<bool>())
|
|
|
|
|
("c,colour", "colour output", cxxopts::value<bool>()->default_value("true"))
|
|
|
|
|
("d,debug", "debug mode - UNENCRYPTED TRAFFIC", cxxopts::value<bool>())
|
|
|
|
|
("b,background", "background mode (start, but do not connect to the network)", cxxopts::value<bool>())
|
|
|
|
|
("config","path to configuration file", cxxopts::value<std::string>());
|
|
|
|
|
|
|
|
|
|
options.parse_positional("config");
|
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
|
|
bool genconfigOnly = false;
|
|
|
|
|
bool asRouter = false;
|
|
|
|
|
bool overWrite = false;
|
|
|
|
|
bool debugMode = false;
|
|
|
|
|
bool genconfigOnly = false;
|
|
|
|
|
bool asRouter = false;
|
|
|
|
|
bool overWrite = false;
|
|
|
|
|
bool backgroundMode = false;
|
|
|
|
|
std::string conffname; // suggestions: confFName? conf_fname?
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
@ -185,9 +185,9 @@ main(int argc, char *argv[])
|
|
|
|
|
genconfigOnly = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(result.count("debug") > 0)
|
|
|
|
|
if(result.count("background") > 0)
|
|
|
|
|
{
|
|
|
|
|
debugMode = true;
|
|
|
|
|
backgroundMode = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(result.count("force") > 0)
|
|
|
|
@ -319,7 +319,7 @@ main(int argc, char *argv[])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::thread main_thread{
|
|
|
|
|
std::bind(&run_main_context, conffname, multiThreaded, debugMode)};
|
|
|
|
|
std::bind(&run_main_context, conffname, multiThreaded, backgroundMode)};
|
|
|
|
|
auto ftr = exit_code.get_future();
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|