From fea88f2cbba206064dbe0e1d35fb2705c0dd40a8 Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Tue, 10 Sep 2024 12:07:46 +0200 Subject: [PATCH] fix deadlock --- src/connect.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/connect.rs b/src/connect.rs index 12973bcb..574b7d03 100644 --- a/src/connect.rs +++ b/src/connect.rs @@ -86,7 +86,11 @@ impl LanMouseConnection { let (buf, len): ([u8; MAX_EVENT_SIZE], usize) = event.into(); let buf = &buf[..len]; if let Some(addr) = self.server.active_addr(handle) { - if let Some(conn) = self.conns.lock().await.get(&addr) { + let conn = { + let conns = self.conns.lock().await; + conns.get(&addr).cloned() + }; + if let Some(conn) = conn { match conn.send(buf).await { Ok(_) => return Ok(()), Err(e) => {