clean up veilid state processing
This commit is contained in:
@@ -333,11 +333,6 @@ impl AttachmentManager {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn send_state_update(&self) {
|
||||
let attachment_machine = self.inner.lock().attachment_machine.clone();
|
||||
attachment_machine.send_state_update().await;
|
||||
}
|
||||
|
||||
pub async fn request_attach(&self) {
|
||||
if !self.is_detached() {
|
||||
trace!("attach request ignored");
|
||||
@@ -395,10 +390,8 @@ impl AttachmentManager {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if eventual.await == state {
|
||||
break;
|
||||
}
|
||||
} else if eventual.await == state {
|
||||
break;
|
||||
}
|
||||
}
|
||||
true
|
||||
|
@@ -68,24 +68,12 @@ where
|
||||
// pub fn clear_state_change_callback(&self) {
|
||||
// self.inner.lock().callback = None;
|
||||
// }
|
||||
|
||||
pub fn state_eventual_instance(&self) -> (T::State, EventualValueCloneFuture<T::State>) {
|
||||
let inner = self.inner.lock();
|
||||
(inner.state, inner.eventual.instance())
|
||||
}
|
||||
|
||||
pub async fn send_state_update(&self) {
|
||||
let (state, callback, eventual) = {
|
||||
let mut inner = self.inner.lock();
|
||||
let eventual =
|
||||
core::mem::replace(&mut inner.eventual, EventualValueClone::<T::State>::new());
|
||||
(inner.state, inner.callback.clone(), eventual)
|
||||
};
|
||||
if let Some(cb) = callback {
|
||||
cb(state, state).await;
|
||||
}
|
||||
eventual.resolve(state).await;
|
||||
}
|
||||
|
||||
pub async fn consume(&self, input: &T::Input) -> Result<Option<T::Output>, ()> {
|
||||
let current_state = self.inner.lock().state;
|
||||
|
||||
|
Reference in New Issue
Block a user