RircdState::run()
This commit is contained in:
parent
e6e4a3df79
commit
eb497a5468
18
src/state.rs
18
src/state.rs
|
@ -1,5 +1,6 @@
|
||||||
use eyre::Result;
|
use eyre::Result;
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
use tokio::task::JoinHandle;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::sync::oneshot;
|
use tokio::sync::oneshot;
|
||||||
|
@ -38,14 +39,19 @@ impl RircdState {
|
||||||
self.endpoints.iter().filter(|ep| ep.is_active()).for_each(|endpoint| {
|
self.endpoints.iter().filter(|ep| ep.is_active()).for_each(|endpoint| {
|
||||||
let endpoint_name = endpoint.name();
|
let endpoint_name = endpoint.name();
|
||||||
let (success_status_send,success_status_recv) = oneshot::channel::<Result<()>>();
|
let (success_status_send,success_status_recv) = oneshot::channel::<Result<()>>();
|
||||||
tokio::spawn(endpoint.listen(success_status_send));
|
tokio::spawn(endpoint.clone().listen(success_status_send));
|
||||||
//TODO color err msg
|
//TODO color err msg
|
||||||
println!("starting {} | {}", endpoint_name,
|
//TODO paralelize and sync at the end
|
||||||
match success_status_recv.await {
|
tokio::task::spawn_local(async move {
|
||||||
Ok(_) => format!("SUCCEEDED |"),
|
println!("starting {} | {}", endpoint_name,
|
||||||
Err(e) => format!("FAILED| <{}>", e),
|
match success_status_recv.await {
|
||||||
});
|
Ok(_) => format!("SUCCEEDED |"),
|
||||||
|
Err(e) => format!("FAILED| <{}>", e),
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue