diff --git a/yazi-dds/src/pubsub.rs b/yazi-dds/src/pubsub.rs index c016889c..845df3e2 100644 --- a/yazi-dds/src/pubsub.rs +++ b/yazi-dds/src/pubsub.rs @@ -72,10 +72,10 @@ impl Pubsub { return Self::pub_(body); } - let (kind, peers) = (body.kind(), PEERS.read()); - if receiver == 0 && peers.values().any(|c| c.able(kind)) { + let kind = body.kind(); + if receiver == 0 && Self::any_remote_own(kind) { Client::push(body); - } else if peers.get(&receiver).is_some_and(|c| c.able(kind)) { + } else if PEERS.read().get(&receiver).is_some_and(|c| c.able(kind)) { Client::push(body.with_receiver(receiver)); } } @@ -140,7 +140,7 @@ impl Pubsub { if LOCAL.read().contains_key("@yank") { Self::pub_(BodyYank::dummy()); } - if Self::own_static_ability("@yank") { + if Self::any_remote_own("@yank") { Client::push(BodyYank::borrowed(cut, urls)); } if BOOT.local_events.contains("@yank") { @@ -185,7 +185,7 @@ impl Pubsub { } #[inline] - fn own_static_ability(kind: &str) -> bool { + fn any_remote_own(kind: &str) -> bool { REMOTE.read().contains_key(kind) // Owned abilities || PEERS.read().values().any(|p| p.able(kind)) // Remote peers' abilities || BOOT.remote_events.contains(kind) // Owned abilities from the command-line argument diff --git a/yazi-dds/src/server.rs b/yazi-dds/src/server.rs index 8085fe51..1e0ae37c 100644 --- a/yazi-dds/src/server.rs +++ b/yazi-dds/src/server.rs @@ -72,7 +72,7 @@ impl Server { } line.push('\n'); - clients.into_iter().filter(|c| c.id != id).for_each(|c| _ = c.tx.send(line.clone())); + clients.into_iter().for_each(|c| _ = c.tx.send(line.clone())); } else => break }