[fix](trx-client): use send_replace for per-rig audio stream info

watch::Sender::send() silently discards the value when receiver_count
is zero.  The per-rig info channel is created with watch::channel().0
which drops the only Receiver, so the first send(Some(info)) after TCP
connect returns early without storing the value.  Later subscribers
see None forever.  send_replace() stores unconditionally.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-24 08:39:29 +01:00
parent 7e447ab1f6
commit e46189e9ac
+2 -2
View File
@@ -325,7 +325,7 @@ async fn run_single_rig_audio_client(
match changed { match changed {
Ok(()) if *shutdown_rx.borrow() => { Ok(()) if *shutdown_rx.borrow() => {
info!("Audio client [{}]: shutting down", rig_id); info!("Audio client [{}]: shutting down", rig_id);
let _ = per_rig_info_tx.send(None); let _ = per_rig_info_tx.send_replace(None);
if is_selected(&selected_rig_id, &rig_id) { if is_selected(&selected_rig_id, &rig_id) {
let _ = global_info_tx.send(None); let _ = global_info_tx.send(None);
} }
@@ -431,7 +431,7 @@ async fn handle_single_rig_connection(
"Audio stream info [{}]: {}Hz, {} ch, {}ms", "Audio stream info [{}]: {}Hz, {} ch, {}ms",
rig_id, info.sample_rate, info.channels, info.frame_duration_ms rig_id, info.sample_rate, info.channels, info.frame_duration_ms
); );
let _ = per_rig_info_tx.send(Some(info.clone())); let _ = per_rig_info_tx.send_replace(Some(info.clone()));
// Mirror to global if this is the selected rig. // Mirror to global if this is the selected rig.
let is_selected = selected_rig_id let is_selected = selected_rig_id