|
|
|
@ -158,7 +158,7 @@ async fn service_fn(SupervisorTaskState {shared, mut recv, mut shutdown}: Superv
|
|
|
|
|
// The command stream to dispatch to the worker tasks
|
|
|
|
|
let command_dispatch = async {
|
|
|
|
|
while let Some(req) = recv.recv().await {
|
|
|
|
|
//TODO: Dispatch
|
|
|
|
|
todo!("Dispatch to child(s)");
|
|
|
|
|
}
|
|
|
|
|
TerminationKind::Graceful
|
|
|
|
|
};
|
|
|
|
@ -170,12 +170,12 @@ async fn service_fn(SupervisorTaskState {shared, mut recv, mut shutdown}: Superv
|
|
|
|
|
{
|
|
|
|
|
use SupervisorControl::*;
|
|
|
|
|
match value {
|
|
|
|
|
Initialise => (),
|
|
|
|
|
Initialise => info!("Initialised"),
|
|
|
|
|
Signal(None) => return TerminationKind::SignalHup,
|
|
|
|
|
Signal(Some(to)) => return TerminationKind::SignalTimeout(to),
|
|
|
|
|
Drop => return TerminationKind::Immediate,
|
|
|
|
|
Restart => (),
|
|
|
|
|
TaskLimit(_limit) => (),
|
|
|
|
|
Restart => todo!("not implemented"),
|
|
|
|
|
TaskLimit(_limit) => todo!("not implemented"),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
TerminationKind::Graceful
|
|
|
|
@ -187,18 +187,15 @@ async fn service_fn(SupervisorTaskState {shared, mut recv, mut shutdown}: Superv
|
|
|
|
|
sd_kind = &mut signal_stream => {
|
|
|
|
|
// We received a signal
|
|
|
|
|
|
|
|
|
|
return Err(ServiceTerminationError::Signal(sd_kind));
|
|
|
|
|
Err(ServiceTerminationError::Signal(sd_kind))
|
|
|
|
|
}
|
|
|
|
|
disp_end = &mut command_dispatch => {
|
|
|
|
|
// The command dispatch exited first, the logical error is `Graceful`. But it's not really an error, so...
|
|
|
|
|
|
|
|
|
|
//TODO: Anything here?
|
|
|
|
|
disp_end.into()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/// The mannor in which the supervisor exited.
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
@ -254,6 +251,15 @@ pub enum ServiceTerminationError
|
|
|
|
|
Interest,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl From<TerminationKind> for Result<(), ServiceTerminationError>
|
|
|
|
|
{
|
|
|
|
|
fn from(from: TerminationKind) -> Self
|
|
|
|
|
{
|
|
|
|
|
ServiceTerminationError::Signal(from).into_own_result()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl ServiceTerminationError
|
|
|
|
|
{
|
|
|
|
|
fn into_own_result(self) -> Result<(), Self>
|
|
|
|
|