[feat](trx-frontend): add server_connected flag to FrontendRuntimeContext

Track whether the remote client currently has an active TCP connection
to trx-server via a shared AtomicBool. Frontends can read this to
surface a distinct "trx-server connection lost" message.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
2026-03-16 23:27:38 +01:00
parent efa51443b6
commit 1f4c3e0384
+4
View File
@@ -271,6 +271,9 @@ pub struct FrontendRuntimeContext {
/// channel (e.g. out-of-bandwidth after center-frequency retune). /// channel (e.g. out-of-bandwidth after center-frequency retune).
/// The HTTP frontend subscribes to clean up `ClientChannelManager`. /// The HTTP frontend subscribes to clean up `ClientChannelManager`.
pub vchan_destroyed: Option<broadcast::Sender<Uuid>>, pub vchan_destroyed: Option<broadcast::Sender<Uuid>>,
/// Whether the remote client currently has an active TCP connection to
/// trx-server. Set to `true` on successful connect, `false` on drop.
pub server_connected: Arc<AtomicBool>,
} }
impl FrontendRuntimeContext { impl FrontendRuntimeContext {
@@ -321,6 +324,7 @@ impl FrontendRuntimeContext {
vchan_audio: Arc::new(RwLock::new(HashMap::new())), vchan_audio: Arc::new(RwLock::new(HashMap::new())),
vchan_audio_cmd: Arc::new(Mutex::new(None)), vchan_audio_cmd: Arc::new(Mutex::new(None)),
vchan_destroyed: None, vchan_destroyed: None,
server_connected: Arc::new(AtomicBool::new(false)),
} }
} }
} }