[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:
@@ -73,16 +73,21 @@ impl FrontendSpawner for HttpJsonFrontend {
|
||||
rig_tx: mpsc::Sender<RigRequest>,
|
||||
_callsign: Option<String>,
|
||||
listen_addr: SocketAddr,
|
||||
context: std::sync::Arc<trx_frontend::FrontendRuntimeContext>,
|
||||
) -> JoinHandle<()> {
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = serve(listen_addr, rig_tx).await {
|
||||
if let Err(e) = serve(listen_addr, rig_tx, context).await {
|
||||
error!("json tcp server error: {:?}", e);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async fn serve(listen_addr: SocketAddr, rig_tx: mpsc::Sender<RigRequest>) -> std::io::Result<()> {
|
||||
async fn serve(
|
||||
listen_addr: SocketAddr,
|
||||
rig_tx: mpsc::Sender<RigRequest>,
|
||||
_context: std::sync::Arc<trx_frontend::FrontendRuntimeContext>,
|
||||
) -> std::io::Result<()> {
|
||||
let listener = TcpListener::bind(listen_addr).await?;
|
||||
info!("json tcp frontend listening on {}", listen_addr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user