From 1f4c3e0384089e10b3be48ef63a6ffa2a5ddecf7 Mon Sep 17 00:00:00 2001 From: Stanislaw Grams Date: Mon, 16 Mar 2026 23:27:38 +0100 Subject: [PATCH] [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 Signed-off-by: Stanislaw Grams --- src/trx-client/trx-frontend/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/trx-client/trx-frontend/src/lib.rs b/src/trx-client/trx-frontend/src/lib.rs index 4c9fb36..01536fd 100644 --- a/src/trx-client/trx-frontend/src/lib.rs +++ b/src/trx-client/trx-frontend/src/lib.rs @@ -271,6 +271,9 @@ pub struct FrontendRuntimeContext { /// channel (e.g. out-of-bandwidth after center-frequency retune). /// The HTTP frontend subscribes to clean up `ClientChannelManager`. pub vchan_destroyed: Option>, + /// 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, } impl FrontendRuntimeContext { @@ -321,6 +324,7 @@ impl FrontendRuntimeContext { vchan_audio: Arc::new(RwLock::new(HashMap::new())), vchan_audio_cmd: Arc::new(Mutex::new(None)), vchan_destroyed: None, + server_connected: Arc::new(AtomicBool::new(false)), } } }