diff options
-rw-r--r-- | client-web/source/index.ts | 3 | ||||
-rw-r--r-- | server/src/main.rs | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/client-web/source/index.ts b/client-web/source/index.ts index c15ec38..a57cec3 100644 --- a/client-web/source/index.ts +++ b/client-web/source/index.ts @@ -3,11 +3,10 @@ import { ediv } from "./helper.ts"; import { log } from "./logger.ts" import { create_menu } from "./menu.ts"; -import { get_param, load_params, PREFS } from "./preferences.ts"; +import { load_params, PREFS } from "./preferences.ts"; import { SignalingConnection } from "./protocol/mod.ts"; import { Room } from "./room.ts" - export const BOTTOM_CONTAINER = ediv({ class: ["bottom-container"] }) export const ROOM_CONTAINER = ediv({ class: ["room"] }) diff --git a/server/src/main.rs b/server/src/main.rs index 57e12f6..d6467d5 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -3,7 +3,7 @@ pub mod room; use hyper::{header, StatusCode}; use listenfd::ListenFd; -use log::error; +use log::{debug, error}; use room::Room; use std::collections::HashMap; use std::convert::Infallible; @@ -93,12 +93,15 @@ async fn handle_rejection(err: Rejection) -> Result<impl Reply, Infallible> { fn signaling_connect(rname: String, rooms: Rooms, ws: warp::ws::Ws) -> impl Reply { async fn inner(sock: WebSocket, rname: String, rooms: Rooms) { + debug!("ws upgrade"); let guard = rooms.read().await; let room = match guard.get(&rname) { Some(r) => r.to_owned(), None => { + debug!("aquire lock for insertion"); drop(guard); // make sure read-lock is dropped to avoid deadlock let mut guard = rooms.write().await; + debug!("create new room"); guard.insert(rname.to_owned(), Default::default()); guard.get(&rname).unwrap().to_owned() // TODO never expect this to always work!! } |