fix deadlock

This commit is contained in:
Ferdinand Schober
2024-09-10 12:07:46 +02:00
parent 874fba670d
commit eb0022995c

View File

@@ -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) => {