mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-16 09:21:28 +03:00
remove unnecessary struct
This commit is contained in:
@@ -56,7 +56,7 @@ pub struct Service {
|
|||||||
pub(crate) client_manager: ClientManager,
|
pub(crate) client_manager: ClientManager,
|
||||||
port: Rc<Cell<u16>>,
|
port: Rc<Cell<u16>>,
|
||||||
public_key_fingerprint: String,
|
public_key_fingerprint: String,
|
||||||
notifies: Rc<Notifies>,
|
frontend_event_pending: Rc<Notify>,
|
||||||
pub(crate) config: Rc<Config>,
|
pub(crate) config: Rc<Config>,
|
||||||
pending_frontend_events: Rc<RefCell<VecDeque<FrontendEvent>>>,
|
pending_frontend_events: Rc<RefCell<VecDeque<FrontendEvent>>>,
|
||||||
capture_status: Rc<Cell<Status>>,
|
capture_status: Rc<Cell<Status>>,
|
||||||
@@ -69,11 +69,6 @@ pub struct Service {
|
|||||||
next_trigger_handle: u64,
|
next_trigger_handle: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
struct Notifies {
|
|
||||||
frontend_event_pending: Notify,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Service {
|
impl Service {
|
||||||
pub async fn new(config: Config) -> Result<Self, ServiceError> {
|
pub async fn new(config: Config) -> Result<Self, ServiceError> {
|
||||||
let client_manager = ClientManager::default();
|
let client_manager = ClientManager::default();
|
||||||
@@ -106,8 +101,8 @@ impl Service {
|
|||||||
public_key_fingerprint,
|
public_key_fingerprint,
|
||||||
config: Rc::new(config),
|
config: Rc::new(config),
|
||||||
client_manager,
|
client_manager,
|
||||||
|
frontend_event_pending: Default::default(),
|
||||||
port,
|
port,
|
||||||
notifies: Default::default(),
|
|
||||||
pending_frontend_events: Rc::new(RefCell::new(VecDeque::new())),
|
pending_frontend_events: Rc::new(RefCell::new(VecDeque::new())),
|
||||||
capture_status: Default::default(),
|
capture_status: Default::default(),
|
||||||
emulation_status: Default::default(),
|
emulation_status: Default::default(),
|
||||||
@@ -222,7 +217,7 @@ impl Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ = self.notifies.frontend_event_pending.notified() => {
|
_ = self.frontend_event_pending.notified() => {
|
||||||
while let Some(event) = {
|
while let Some(event) = {
|
||||||
/* need to drop borrow before next iteration! */
|
/* need to drop borrow before next iteration! */
|
||||||
let event = self.pending_frontend_events.borrow_mut().pop_front();
|
let event = self.pending_frontend_events.borrow_mut().pop_front();
|
||||||
@@ -378,7 +373,7 @@ impl Service {
|
|||||||
|
|
||||||
fn notify_frontend(&self, event: FrontendEvent) {
|
fn notify_frontend(&self, event: FrontendEvent) {
|
||||||
self.pending_frontend_events.borrow_mut().push_back(event);
|
self.pending_frontend_events.borrow_mut().push_back(event);
|
||||||
self.notifies.frontend_event_pending.notify_one();
|
self.frontend_event_pending.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn client_updated(&self, handle: ClientHandle) {
|
pub(crate) fn client_updated(&self, handle: ClientHandle) {
|
||||||
|
|||||||
Reference in New Issue
Block a user