fixes for stats and crash

This commit is contained in:
John Smith
2022-05-18 10:17:04 -04:00
parent 1326424eae
commit f4f5808df2
9 changed files with 92 additions and 20 deletions

View File

@@ -16,6 +16,13 @@ fn do_clap_matches(default_config_path: &OsStr) -> Result<clap::ArgMatches, clap
.short('d')
.help("Run in daemon mode in the background"),
)
.arg(
Arg::new("foreground")
.long("foreground")
.short('f')
.conflicts_with("daemon")
.help("Run in the foreground"),
)
.arg(
Arg::new("config-file")
.short('c')
@@ -155,6 +162,9 @@ pub fn process_command_line() -> Result<(Settings, ArgMatches), String> {
settingsrw.daemon.enabled = true;
settingsrw.logging.terminal.enabled = false;
}
if matches.occurrences_of("foreground") != 0 {
settingsrw.daemon.enabled = false;
}
if matches.occurrences_of("subnode-index") != 0 {
let subnode_index = match matches.value_of("subnode-index") {
Some(x) => x
@@ -219,7 +229,7 @@ pub fn process_command_line() -> Result<(Settings, ArgMatches), String> {
}
if matches.occurrences_of("bootstrap") != 0 {
let bootstrap_list = match matches.value_of("bootstrap-list") {
let bootstrap_list = match matches.value_of("bootstrap") {
Some(x) => {
println!("Overriding bootstrap list with: ");
let mut out: Vec<String> = Vec::new();
@@ -231,14 +241,14 @@ pub fn process_command_line() -> Result<(Settings, ArgMatches), String> {
out
}
None => {
return Err("value not specified for bootstrap list".to_owned());
return Err("value not specified for bootstrap".to_owned());
}
};
settingsrw.core.network.bootstrap = bootstrap_list;
}
if matches.occurrences_of("bootstrap-nodes") != 0 {
let bootstrap_list = match matches.value_of("bootstrap-list") {
let bootstrap_list = match matches.value_of("bootstrap-nodes") {
Some(x) => {
println!("Overriding bootstrap node list with: ");
let mut out: Vec<ParsedNodeDialInfo> = Vec::new();

View File

@@ -159,6 +159,11 @@ pub async fn run_veilid_server(
shutdown();
}
// Process shutdown-immediate
if matches!(server_mode, ServerMode::ShutdownImmediate) {
shutdown();
}
// Idle while waiting to exit
let shutdown_switch = {
let shutdown_switch_locked = SHUTDOWN_SWITCH.lock();