Leave room when connection is dropped

This commit is contained in:
Antonio Scandurra 2022-11-14 10:13:36 +01:00
parent 2145965749
commit 9902211af1
7 changed files with 184 additions and 235 deletions

View file

@ -3,7 +3,7 @@ use anyhow::{anyhow, Result};
use collections::{btree_map, BTreeMap, BTreeSet, HashMap, HashSet};
use rpc::{proto, ConnectionId};
use serde::Serialize;
use std::{borrow::Cow, mem, path::PathBuf, str};
use std::{mem, path::PathBuf, str};
use tracing::instrument;
pub type RoomId = u64;
@ -135,14 +135,6 @@ impl Store {
Ok(())
}
pub fn user_id_for_connection(&self, connection_id: ConnectionId) -> Result<UserId> {
Ok(self
.connections
.get(&connection_id)
.ok_or_else(|| anyhow!("unknown connection"))?
.user_id)
}
pub fn connection_ids_for_user(
&self,
user_id: UserId,