diff options
author | metamuffin <metamuffin@disroot.org> | 2022-09-07 18:05:27 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-09-07 18:05:27 +0200 |
commit | 88241946e3144fede5c86f98d00bb723c1cc2761 (patch) | |
tree | acd61d75fbd48d09ff76541ab15a9703d7c98652 /server/src/main.rs | |
parent | 3ce9a53e272dc556222bca747461b3ec24796912 (diff) | |
download | keks-meet-88241946e3144fede5c86f98d00bb723c1cc2761.tar keks-meet-88241946e3144fede5c86f98d00bb723c1cc2761.tar.bz2 keks-meet-88241946e3144fede5c86f98d00bb723c1cc2761.tar.zst |
compiler crash………
Diffstat (limited to 'server/src/main.rs')
-rw-r--r-- | server/src/main.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/src/main.rs b/server/src/main.rs index ff34ad0..b4121b9 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -1,5 +1,3 @@ -#![feature(async_closure)] - pub mod protocol; pub mod room; @@ -11,6 +9,7 @@ use room::Room; use std::convert::Infallible; use std::sync::Arc; use warp::hyper::Server; +use warp::ws::WebSocket; use warp::{Filter, Rejection, Reply}; type Rooms = Arc<CHashMap<String, Room>>; @@ -73,7 +72,7 @@ async fn handle_rejection(err: Rejection) -> Result<impl Reply, Infallible> { } fn signaling_connect(rname: String, rooms: Rooms, ws: warp::ws::Ws) -> impl Reply { - ws.on_upgrade(async move |sock| { + async fn inner(sock: WebSocket, rname: String, rooms: Rooms) { let room = match rooms.get(&rname) { Some(r) => r, None => { @@ -85,5 +84,6 @@ fn signaling_connect(rname: String, rooms: Rooms, ws: warp::ws::Ws) -> impl Repl if room.should_remove().await { rooms.remove(&rname); } - }) + } + ws.on_upgrade(move |sock| inner(sock, rname, rooms)) } |