[refactor](trx-frontend-*): update frontend implementations for context parameter
Update all three built-in frontends to accept Arc<FrontendRuntimeContext> parameter in their spawn_frontend implementations: - trx-frontend-http: passes context to serve function - trx-frontend-http-json: passes context to serve function - trx-frontend-rigctl: accepts context (minimal impact, no globals used) Frontends are now ready to use context for audio channels, decode channels, and auth tokens instead of accessing globals directly. This completes the trait signature change for all frontends. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
@@ -22,7 +22,7 @@ use tracing::{error, info};
|
||||
|
||||
use trx_core::RigRequest;
|
||||
use trx_core::RigState;
|
||||
use trx_frontend::FrontendSpawner;
|
||||
use trx_frontend::{FrontendSpawner, FrontendRuntimeContext};
|
||||
|
||||
/// HTTP frontend implementation.
|
||||
pub struct HttpFrontend;
|
||||
@@ -33,9 +33,10 @@ impl FrontendSpawner for HttpFrontend {
|
||||
rig_tx: mpsc::Sender<RigRequest>,
|
||||
callsign: Option<String>,
|
||||
listen_addr: SocketAddr,
|
||||
context: Arc<FrontendRuntimeContext>,
|
||||
) -> JoinHandle<()> {
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = serve(listen_addr, state_rx, rig_tx, callsign).await {
|
||||
if let Err(e) = serve(listen_addr, state_rx, rig_tx, callsign, context).await {
|
||||
error!("HTTP status server error: {:?}", e);
|
||||
}
|
||||
})
|
||||
@@ -47,6 +48,7 @@ async fn serve(
|
||||
state_rx: watch::Receiver<RigState>,
|
||||
rig_tx: mpsc::Sender<RigRequest>,
|
||||
callsign: Option<String>,
|
||||
_context: Arc<FrontendRuntimeContext>,
|
||||
) -> Result<(), actix_web::Error> {
|
||||
let server = build_server(addr, state_rx, rig_tx, callsign)?;
|
||||
let handle = server.handle();
|
||||
|
||||
Reference in New Issue
Block a user