Skip to content

Commit

Permalink
fix deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
feschber committed Oct 7, 2024
1 parent 54191d5 commit fea88f2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit fea88f2

Please sign in to comment.