chiark / gitweb /
server: reorganise setup
[hippotat.git] / src / bin / server.rs
index 297740a1552ff729de9b71c3f6a5c902f54502d6..cabd18ca2f9a0454c5c4569dcdbf00901d630f62 100644 (file)
@@ -433,23 +433,26 @@ async fn main() {
       )).unzip::<_,_,Vec<_>,Vec<_>>();
 
     let all_clients = izip!(
-      ics.into_iter(),
+      ics.iter(),
       client_handles_send,
-      client_handles_recv,
-    ).map(|(ic, web_send, web_recv)| {
-      let r = (ic.link.client,
-           Client {
-             ic: ic.clone(),
-             web: web_send,
-           });
+    ).map(|(ic, web_send)| {
+      (ic.link.client,
+       Client {
+         ic: ic.clone(),
+         web: web_send,
+       })
+    }).collect();
 
+    for (ic, web_recv) in izip!(
+      ics.into_iter(),
+      client_handles_recv,
+    ) {
       let ic_ = ic.clone();
       tasks.push((tokio::spawn(async move {
         run_client(ic_, web_recv).await.void_unwrap_err()
       }), format!("client {}", &ic)));
+    }
 
-      r
-    }).collect();
     let global = Arc::new(Global {
       config: global_config,
       all_clients,