forked from lavina/lavina
wip
This commit is contained in:
parent
cb889193c7
commit
3e414f4038
|
@ -26,6 +26,7 @@ impl Broadcasting {
|
|||
}
|
||||
|
||||
/// Broadcasts the given update to subscribed player actors on local node.
|
||||
#[tracing::instrument(skip(self, players, message, created_at), name = "Broadcasting::broadcast")]
|
||||
pub async fn broadcast(
|
||||
&self,
|
||||
players: &PlayerRegistry,
|
||||
|
|
|
@ -721,16 +721,18 @@ impl Player {
|
|||
async fn get_rooms(&self) -> Vec<RoomInfo> {
|
||||
let mut response = vec![];
|
||||
for (room_id, handle) in &self.my_rooms {
|
||||
if let RoomRef::Local(handle) = handle {
|
||||
response.push(handle.get_room_info().await);
|
||||
} else {
|
||||
let room_info = RoomInfo {
|
||||
id: room_id.clone(),
|
||||
topic: "unknown".into(),
|
||||
members: vec![],
|
||||
};
|
||||
response.push(room_info);
|
||||
// TODO
|
||||
match handle {
|
||||
RoomRef::Local(handle) => {
|
||||
response.push(handle.get_room_info().await);
|
||||
}
|
||||
RoomRef::Remote { .. } => {
|
||||
let room_info = RoomInfo {
|
||||
id: room_id.clone(),
|
||||
topic: "unknown".into(),
|
||||
members: vec![],
|
||||
};
|
||||
response.push(room_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
response
|
||||
|
|
|
@ -50,6 +50,7 @@ impl Storage {
|
|||
}
|
||||
|
||||
pub async fn create_or_retrieve_room_id_by_name(&self, name: &str) -> Result<u32> {
|
||||
// TODO we don't need any info except the name on non-owning nodes, should remove stubs here
|
||||
let mut executor = self.conn.lock().await;
|
||||
let res: (u32,) = sqlx::query_as(
|
||||
"insert into rooms(name, topic)
|
||||
|
|
Loading…
Reference in New Issue