Find and watch streams in every channel, without a gateway

The server announces a stream only to the clients in the streamer's
channel. Voelin looked up streams that started before it joined
(`requeststreaminfo`), but only in its own channel, so a stream anywhere
else on the server appeared only through a gateway's directory. The
official client lists and joins them without one: `requeststreaminfo`
answers from any channel, and a `joinstreamrequest` from another channel
reaches the streamer (confirmed on the TS6 dev server with the probe).

- Discovery follows every streaming client on the server: it looks up
  the streams of clients in other channels as soon as they stream, keeps
  them when we or they change channels, and drops them when the streamer
  stops or leaves.
- The streams panel lists every channel's streams, ours first, the
  others with their channel ("by X · in Gaming"); clients still being
  looked up show in any channel. The viewer's note names the stream's
  channel instead of claiming it can only be watched from there.
- As a streamer with `stream.permissions = channel` (the default), our
  channel is let in and viewers from other channels are asked, as the
  setting's description ("who may watch without being asked") says;
  they were refused before.

Tested: discovery unit tests for the new rules; the engine's permission
test; the app headless (no gateway) on the TS6 dev server found and played
a stream in another channel and one that started before it joined;
scripts/it-smoke.sh gains a step where a viewer in the default channel
watches a stream in another channel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 22:01:10 +03:00
1 parent cacb023ccf
commit f61c34b42c
10 files changed
+162 -67

No files matched your search

+8 -7
View File
@@ -1672,10 +1672,10 @@ impl Streams {
/// Feed a stream notification from the connection.
pub async fn handle_notification(&mut self, n: StreamNotification) {
// Looked up streams of clients that have left our channel since.
let elsewhere = matches!(&n, StreamNotification::Info(info)
if !self.discovery.in_our_channel(info.streamer));
if !elsewhere && self.directory.apply(&n) {
// Looked up streams of clients that have left the server since.
let gone = matches!(&n, StreamNotification::Info(info)
if !self.discovery.knows(info.streamer));
if !gone && self.directory.apply(&n) {
self.emit_streams();
}
if let Some(s) = &mut self.streamer
@@ -1706,8 +1706,9 @@ impl Streams {
}
/// The clients on the server changed (full list, with ourselves): keeps
/// the directory to the streams in our channel and looks up the streams
/// the server did not announce to us (see [`crate::discovery`]). Covers
/// the directory to the streams of clients that are on the server and
/// stream, in any channel, and looks up the streams the server did not
/// announce to us (see [`crate::discovery`]). Covers
/// [`Self::set_client_streaming`] and [`Self::retain_streamers`].
pub fn update_clients(&mut self, clients: BTreeMap<u16, ClientState>) {
if self.discovery.update(clients, &mut self.directory, &mut self.out) {
@@ -1717,7 +1718,7 @@ impl Streams {
/// A stream found by another [`StreamLookup`] (e.g. a gateway's directory).
pub fn discovered(&mut self, info: StreamInfo) {
if self.discovery.in_our_channel(info.streamer)
if self.discovery.knows(info.streamer)
&& self.directory.apply(&StreamNotification::Info(info))
{
self.emit_streams();