From 7dfe6e029539f538c77b78322064ec51beb6a2e4 Mon Sep 17 00:00:00 2001 From: Nikita Vilunov Date: Tue, 14 Feb 2023 23:43:59 +0100 Subject: [PATCH] fix some stuff --- src/core/player.rs | 14 +++++--------- src/core/room.rs | 8 -------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/core/player.rs b/src/core/player.rs index 3abdead..51c5187 100644 --- a/src/core/player.rs +++ b/src/core/player.rs @@ -294,17 +294,13 @@ impl Player { room.subscribe(self.player_id.clone(), self.handle.clone()) .await; self.my_rooms.insert(room_id.clone(), room.clone()); - let members = room.get_members().await; - promise.send(RoomInfo { - id: room_id.clone(), - members, - topic: b"some topic lol".to_vec(), - }); + let room_info = room.get_room_info().await; + promise.send(room_info); let update = Updates::RoomJoined { room_id, new_member_id: self.player_id.clone(), }; - self.broadcast_update(update, connection_id); + self.broadcast_update(update, connection_id).await; } Cmd::SendMessage { room_id, @@ -324,7 +320,7 @@ impl Player { author_id: self.player_id.clone(), body, }; - self.broadcast_update(update, connection_id); + self.broadcast_update(update, connection_id).await; } Cmd::ChangeTopic { room_id, @@ -340,7 +336,7 @@ impl Player { } promise.send(()); let update = Updates::RoomTopicChanged { room_id, new_topic }; - self.broadcast_update(update, connection_id); + self.broadcast_update(update, connection_id).await; } } } diff --git a/src/core/room.rs b/src/core/room.rs index cccb129..2bc1d6a 100644 --- a/src/core/room.rs +++ b/src/core/room.rs @@ -90,14 +90,6 @@ impl RoomHandle { lock.send_message(player_id, body).await; } - pub async fn get_members(&self) -> Vec { - let lock = self.0.read().await; - lock.subscriptions - .keys() - .map(|x| x.clone()) - .collect::>() - } - pub async fn get_room_info(&self) -> RoomInfo { let lock = self.0.read().await; RoomInfo {