MSC3575: allow empty conn_id

This commit is contained in:
Lambda 2025-08-10 18:53:10 +00:00
parent 64ad940bad
commit ede39370a4
2 changed files with 13 additions and 23 deletions

View file

@ -83,10 +83,8 @@ pub(crate) async fn sync_events_v4_route(
}; };
if globalsince == 0 { if globalsince == 0 {
if body.conn_id.is_some() {
services().users.forget_sync_request_connection(&connection_key); services().users.forget_sync_request_connection(&connection_key);
} }
}
let known_rooms = let known_rooms =
services().users.get_rooms_in_connection(connection_key.clone()); services().users.get_rooms_in_connection(connection_key.clone());
@ -377,7 +375,6 @@ pub(crate) async fn sync_events_v4_route(
}, },
); );
if body.conn_id.is_some() {
services().users.update_sync_known_rooms( services().users.update_sync_known_rooms(
connection_key.clone(), connection_key.clone(),
list_id, list_id,
@ -385,7 +382,6 @@ pub(crate) async fn sync_events_v4_route(
globalsince, globalsince,
); );
} }
}
let mut known_subscription_rooms = BTreeSet::new(); let mut known_subscription_rooms = BTreeSet::new();
for (room_id, room) in &body.room_subscriptions { for (room_id, room) in &body.room_subscriptions {
@ -405,14 +401,12 @@ pub(crate) async fn sync_events_v4_route(
known_subscription_rooms.remove(&r); known_subscription_rooms.remove(&r);
} }
if body.conn_id.is_some() {
services().users.update_sync_known_rooms( services().users.update_sync_known_rooms(
connection_key.clone(), connection_key.clone(),
"subscriptions".to_owned(), "subscriptions".to_owned(),
known_subscription_rooms, known_subscription_rooms,
globalsince, globalsince,
); );
}
let mut rooms = BTreeMap::new(); let mut rooms = BTreeMap::new();
for ( for (

View file

@ -70,10 +70,6 @@ impl Service {
&self, &self,
connection_key: ConnectionKey, connection_key: ConnectionKey,
) -> BTreeMap<String, BTreeMap<OwnedRoomId, u64>> { ) -> BTreeMap<String, BTreeMap<OwnedRoomId, u64>> {
if connection_key.connection.is_none() {
return BTreeMap::new();
};
let cached = self.get_cache_entry(connection_key); let cached = self.get_cache_entry(connection_key);
let cached = cached.lock().unwrap(); let cached = cached.lock().unwrap();