server api

This commit is contained in:
John Smith
2023-06-07 17:39:10 -04:00
parent 88db69c28f
commit 317f036598
14 changed files with 423 additions and 259 deletions
+2 -21
View File
@@ -2,13 +2,11 @@ use crate::server::*;
use crate::settings::Settings;
use crate::tools::*;
use crate::veilid_logs::*;
use crate::*;
use clap::ArgMatches;
use futures_util::StreamExt;
use signal_hook::consts::signal::*;
use signal_hook_async_std::Signals;
//use std::io::Read;
use tracing::*;
use veilid_core::tools::*;
#[instrument(skip(signals))]
async fn handle_signals(mut signals: Signals) {
@@ -33,24 +31,7 @@ pub fn run_daemon(settings: Settings, _matches: ArgMatches) -> EyreResult<()> {
let mut daemon = daemonize::Daemonize::new();
let s = settings.read();
if let Some(pid_file) = s.daemon.pid_file.clone() {
daemon = daemon.pid_file(pid_file.clone()); //.chown_pid_file(true);
// daemon = daemon.exit_action(move || {
// // wait for pid file to exist before exiting parent
// let pid_path = std::path::Path::new(&pid_file);
// loop {
// if let Ok(mut f) = std::fs::File::open(pid_path) {
// let mut s = String::new();
// if f.read_to_string(&mut s).is_ok()
// && !s.is_empty()
// && s.parse::<u32>().is_ok()
// {
// println!("pidfile found");
// break;
// }
// }
// std::thread::sleep(std::time::Duration::from_millis(100));
// }
// })
daemon = daemon.pid_file(pid_file.clone());
}
if let Some(chroot) = &s.daemon.chroot {
daemon = daemon.chroot(chroot);