From: Ian Jackson Date: Mon, 16 Aug 2021 23:41:33 +0000 (+0100) Subject: server: reorganise setup X-Git-Tag: hippotat/1.0.0~142 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=1bc60950eb070700d779f552d252e8f8274610bf;hp=775d0a9f2eebe1be2ac404e185546e433a5c2726;p=hippotat.git server: reorganise setup Signed-off-by: Ian Jackson --- diff --git a/src/bin/server.rs b/src/bin/server.rs index b0d347c..297740a 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -425,6 +425,7 @@ async fn main() { let ipif = Ipif::start(&global_config.ipif, None)?; + let ics = ics.into_iter().map(Arc::new).collect_vec(); let (client_handles_send, client_handles_recv) = ics.iter() .map(|_ic| mpsc::channel( 5 // xxx should me max_requests_outstanding but that's @@ -436,18 +437,18 @@ async fn main() { client_handles_send, client_handles_recv, ).map(|(ic, web_send, web_recv)| { - let ic = Arc::new(ic); + let r = (ic.link.client, + Client { + ic: ic.clone(), + web: web_send, + }); let ic_ = ic.clone(); tasks.push((tokio::spawn(async move { run_client(ic_, web_recv).await.void_unwrap_err() }), format!("client {}", &ic))); - (ic.link.client, - Client { - ic, - web: web_send, - }) + r }).collect(); let global = Arc::new(Global { config: global_config,