revert: bring back task abstraction

This commit is contained in:
Nova
2025-10-11 15:51:26 -07:00
parent ba5415653e
commit 6742caa967
7 changed files with 66 additions and 49 deletions

View File

@@ -51,6 +51,7 @@ use bevy_mod_xr::session::{XrFirst, XrHandleEvents, XrSessionPlugin};
use clap::Parser;
use core::client::{Client, tick_internal_client};
use core::entity_handle::EntityHandlePlugin;
use core::task;
use directories::ProjectDirs;
use nodes::audio::AudioNodePlugin;
use nodes::drawable::lines::LinesNodePlugin;
@@ -167,19 +168,17 @@ async fn main() -> Result<AppExit, JoinError> {
);
let socket = UnixListener::bind(locked_socket.socket_path)
.expect("Couldn't spawn stardust server at {socket_path}");
tokio::task::Builder::new()
.name("Stardust client accept loop")
.spawn(async move {
loop {
let Ok((stream, _)) = socket.accept().await else {
continue;
};
if let Err(e) = Client::from_connection(stream) {
error!(?e, "Unable to create client from connection");
}
task::new(|| "Stardust socket accept loop", async move {
loop {
let Ok((stream, _)) = socket.accept().await else {
continue;
};
if let Err(e) = Client::from_connection(stream) {
error!(?e, "Unable to create client from connection");
}
})
.unwrap();
}
})
.unwrap();
info!("Init client join loop");
let project_dirs = ProjectDirs::from("", "", "stardust");