mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-07-09 18:18:11 -07:00
0a1dce3215
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>
25 lines
611 B
Rust
25 lines
611 B
Rust
use log::info;
|
|
use tokio::sync::mpsc::Receiver;
|
|
use tokio_util::sync::CancellationToken;
|
|
use tokio_util::task::TaskTracker;
|
|
|
|
use crate::config;
|
|
use crate::display::DisplayState;
|
|
|
|
pub fn update_ui(
|
|
task_tracker: &TaskTracker,
|
|
_config: &config::Config,
|
|
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() => {}
|
|
}
|
|
}
|
|
});
|
|
}
|