mirror of
https://github.com/sxyazi/yazi.git
synced 2026-05-13 08:16:40 +00:00
fix: DDS static messages only work when at least two instances are running (#1467)
This commit is contained in:
parent
ce944bca88
commit
44f45fd8e1
2 changed files with 6 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue