Publish the channel tree's lists whole instead of refilling them

buildTree() cleared and refilled the children and client lists inside
the shared channel nodes, so a UI still walking the previous tree could
see them change under it. It now builds new lists and publishes them
unmodifiable. The node fields, written by the event and audio threads
and read by the UI, are volatile.

Whether a channel is full is now counted from the model, rather than
from a tree that may not have been rebuilt since the last join.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 10:38:25 +00:00
parent 665316d515
commit 67f8f46cab
4 changed files with 79 additions and 62 deletions

View File

@@ -53,7 +53,6 @@ class ServerModelRulesTest {
channel.subscribed = true;
assertTrue(model.canJoinChannel(1));
channel.maxClients = 1;
channel.clients.add(model.getClient(5));
assertFalse(model.canJoinChannel(1), "full");
assertFalse(model.canJoinChannel(2), "unknown");
}