fix(event loop, client): better async

This commit is contained in:
Nova
2023-01-14 12:38:05 -05:00
parent 198b342dec
commit 27d75d3098
7 changed files with 171 additions and 133 deletions

View File

@@ -42,9 +42,8 @@ struct CliArgs {
}
fn main() -> Result<()> {
if !cfg!(feature = "profile") {
tracing_subscriber::fmt::init();
}
#[cfg(not(feature = "profile"))]
tracing_subscriber::fmt::init();
#[cfg(feature = "profile")]
console_subscriber::init();
let project_dirs = ProjectDirs::from("", "", "stardust").unwrap();
@@ -163,8 +162,7 @@ async fn event_loop(
let _ = handle_sender.send(Handle::current());
// console_subscriber::init();
let (event_loop, event_loop_join_handle) =
EventLoop::new().expect("Couldn't create server socket");
let event_loop = EventLoop::new().expect("Couldn't create server socket");
info!("Init event loop");
info!(
"Stardust socket created at {}",
@@ -175,7 +173,6 @@ async fn event_loop(
biased;
_ = tokio::signal::ctrl_c() => Ok(()),
_ = stop_rx => Ok(()),
e = event_loop_join_handle => e?,
};
info!("Cleanly shut down event loop");