From 5599e2633c11f1bb3ef99135647aff71ada0b8af Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 14 Nov 2018 14:28:54 +0100 Subject: [PATCH] correctly use Arc pointer --- src/main.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0af3dd22..9e58681a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -215,7 +215,7 @@ fn handle_static_file_download(filename: PathBuf) -> BoxFut { return Box::new(response); } -fn handle_request<'a>(api: &'a ApiServer, req: Request) -> BoxFut { +fn handle_request(api: Arc, req: Request) -> BoxFut { let (parts, body) = req.into_parts(); @@ -292,15 +292,14 @@ fn main() { api_server.add_alias("xtermjs", "/usr/share/pve-xtermjs"); api_server.add_alias("widgettoolkit", "/usr/share/javascript/proxmox-widget-toolkit"); - let api_server = Arc::new(api_server); - + let new_svc = move || { - let api = api_server.clone(); + let api_server = api_server.clone(); service_fn(move |req| { - handle_request(&api, req).then(|result| { + handle_request(api_server.clone(), req).then(|result| { match result { Ok(res) => Ok::<_,String>(res), Err(err) => {