configure restarting manager

This commit is contained in:
Alwin Berger 2023-03-09 10:16:08 +01:00
parent 58be280a62
commit 7f987b037d
2 changed files with 26 additions and 19 deletions

View File

@ -10,6 +10,7 @@ std = []
snapshot_restore = [] snapshot_restore = []
snapshot_fast = [ "snapshot_restore" ] snapshot_fast = [ "snapshot_restore" ]
singlecore = [] singlecore = []
restarting = ['singlecore']
trace_abbs = [] trace_abbs = []
systemstate = [] systemstate = []
feed_systemgraph = [ "systemstate" ] feed_systemgraph = [ "systemstate" ]

View File

@ -508,24 +508,30 @@ pub fn fuzz() {
#[cfg(feature = "singlecore")] #[cfg(feature = "singlecore")]
{ {
let monitor = SimpleMonitor::new(|s| println!("{}", s)); let monitor = SimpleMonitor::new(|s| println!("{}", s));
// let mgr = SimpleEventManager::new(monitor); #[cfg(not(feature = "restarting"))]
// run_client(None, mgr, 0);
let mut shmem_provider = StdShMemProvider::new().unwrap();
let (state, mut mgr) = match SimpleRestartingEventManager::launch(monitor, &mut shmem_provider)
{ {
// The restarting state will spawn the same process again as child, then restarted it each time it crashes. let mgr = SimpleEventManager::new(monitor);
Ok(res) => res, run_client(None, mgr, 0);
Err(err) => match err { }
Error::ShuttingDown => {
return; #[cfg(feature = "restarting")]
} {
_ => { let mut shmem_provider = StdShMemProvider::new().unwrap();
panic!("Failed to setup the restarter: {}", err); let (state, mut mgr) = match SimpleRestartingEventManager::launch(monitor, &mut shmem_provider)
} {
}, // The restarting state will spawn the same process again as child, then restarted it each time it crashes.
}; Ok(res) => res,
run_client(state, mgr, 0); Err(err) => match err {
Error::ShuttingDown => {
return;
}
_ => {
panic!("Failed to setup the restarter: {}", err);
}
},
};
run_client(state, mgr, 0);
}
} }
// else -> multicore // else -> multicore
#[cfg(not(feature = "singlecore"))] #[cfg(not(feature = "singlecore"))]