host/serve: extract HTTP fanout from wayland.rs

The broadcast fanout, supervisor-facing listener bind, accept loop, and
per-viewer drain were all sitting inside host/wayland.rs even though
none of it is Wayland-specific. Move them to host/serve.rs so the X11
backend can share the same serving layer with a one-line constructor
call instead of copy-pasting (and drifting on) the fanout code.

No behavior change. Wayland's CaptureHandle now wraps a serve::Serve
instead of owning the listener/reader/server fields directly; gst
pipeline construction is unchanged. connect_to_capture moves alongside
Serve since it pairs with it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-22 02:32:35 -04:00
parent f939441e31
commit e1a018fdf7
3 changed files with 216 additions and 172 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
mod capture;
mod serve;
mod wayland;
use anyhow::{Result, bail};
@@ -135,7 +136,7 @@ async fn handle_peer(
eprintln!("[pixelpass] viewer connected: {remote}");
let tcp = match wayland::connect_to_capture(port, Duration::from_secs(5)).await {
let tcp = match serve::connect_to_capture(port, Duration::from_secs(5)).await {
Ok(t) => t,
Err(e) => {
tracing::warn!(%remote, "connect_to_capture failed: {e:#}");