mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-03 06:38:52 +00:00
feat: unified and more comprehensive xrservice alive detection
This commit is contained in:
parent
5494306ac2
commit
665242aa28
2 changed files with 17 additions and 10 deletions
|
@ -357,10 +357,10 @@ impl SimpleComponent for App {
|
||||||
Msg::ClockTicking => {
|
Msg::ClockTicking => {
|
||||||
self.main_view.sender().emit(MainViewMsg::ClockTicking);
|
self.main_view.sender().emit(MainViewMsg::ClockTicking);
|
||||||
let should_poll_for_devices = self.xrservice_ready
|
let should_poll_for_devices = self.xrservice_ready
|
||||||
&& self.xrservice_worker.as_ref().is_some_and(|w| {
|
&& self
|
||||||
let state = w.state.lock().unwrap();
|
.xrservice_worker
|
||||||
state.exit_status.is_none() && !state.stop_requested
|
.as_ref()
|
||||||
});
|
.is_some_and(JobWorker::is_alive);
|
||||||
if should_poll_for_devices {
|
if should_poll_for_devices {
|
||||||
if let Some(monado) = self.libmonado.as_ref() {
|
if let Some(monado) = self.libmonado.as_ref() {
|
||||||
self.xr_devices = XRDevice::from_libmonado(monado);
|
self.xr_devices = XRDevice::from_libmonado(monado);
|
||||||
|
@ -722,15 +722,17 @@ impl SimpleComponent for App {
|
||||||
self.xrservice_ready = success;
|
self.xrservice_ready = success;
|
||||||
self.main_view
|
self.main_view
|
||||||
.sender()
|
.sender()
|
||||||
.emit(MainViewMsg::UpdateXrServiceReady(success));
|
.emit(MainViewMsg::UpdateXrServiceReady(true));
|
||||||
if success {
|
if self
|
||||||
self.run_autostart(sender.clone());
|
|
||||||
} else if self
|
|
||||||
.xrservice_worker
|
.xrservice_worker
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.is_some_and(|w| w.exit_code().is_none())
|
.is_some_and(JobWorker::is_alive)
|
||||||
{
|
{
|
||||||
sender.input(Msg::StartProber);
|
if success {
|
||||||
|
self.run_autostart(sender.clone());
|
||||||
|
} else {
|
||||||
|
sender.input(Msg::StartProber);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,4 +123,9 @@ impl JobWorker {
|
||||||
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_alive(&self) -> bool {
|
||||||
|
let state = self.state.lock().unwrap();
|
||||||
|
!state.stop_requested && state.started && !state.exited && state.exit_status.is_none()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue