fix(daemon): drain UI channel in headless mode to prevent panic

On PinePhone (headless display), the UI update receiver was dropped
immediately, causing sends from diag.rs to fail with SendError and
panic. Spawn a task that drains the channel until shutdown.

Fixes #657

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Deven Ducommun
2026-06-09 14:21:27 -07:00
committed by Cooper Quintin
parent 2df31300e3
commit 0a1dce3215
+11 -3
View File
@@ -7,10 +7,18 @@ use crate::config;
use crate::display::DisplayState;
pub fn update_ui(
_task_tracker: &TaskTracker,
task_tracker: &TaskTracker,
_config: &config::Config,
_shutdown_token: CancellationToken,
_ui_update_rx: Receiver<DisplayState>,
shutdown_token: CancellationToken,
mut ui_update_rx: Receiver<DisplayState>,
) {
info!("Headless mode, not spawning UI.");
task_tracker.spawn(async move {
loop {
tokio::select! {
_ = shutdown_token.cancelled() => break,
_ = ui_update_rx.recv() => {}
}
}
});
}