mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-26 22:50:56 +03:00
explicit state synchronisation (#129)
prevents unnecessary state updates and makes synchronization less error prone
This commit is contained in:
committed by
GitHub
parent
9969f997d3
commit
e9738fc024
@@ -35,7 +35,7 @@ pub fn new(
|
||||
Ok(ips) => ips,
|
||||
Err(e) => {
|
||||
log::warn!("could not resolve host '{host}': {e}");
|
||||
continue;
|
||||
vec![]
|
||||
}
|
||||
};
|
||||
|
||||
@@ -59,14 +59,10 @@ async fn notify_state_change(
|
||||
server: &mut Server,
|
||||
handle: ClientHandle,
|
||||
) {
|
||||
let state = server
|
||||
.client_manager
|
||||
.borrow_mut()
|
||||
.get_mut(handle)
|
||||
.map(|(_, s)| s.clone());
|
||||
if let Some(state) = state {
|
||||
let state = server.client_manager.borrow_mut().get_mut(handle).cloned();
|
||||
if let Some((config, state)) = state {
|
||||
let _ = frontend
|
||||
.send(FrontendEvent::StateChange(handle, state))
|
||||
.send(FrontendEvent::State(handle, config, state))
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user