Fix potential double locking when finding shared rooms
This commit is contained in:
parent
5927733562
commit
4052ec532b
@ -74,6 +74,8 @@ func (cache *RoomCache) IsEncrypted(roomID id.RoomID) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cache *RoomCache) FindSharedRooms(userID id.UserID) (shared []id.RoomID) {
|
func (cache *RoomCache) FindSharedRooms(userID id.UserID) (shared []id.RoomID) {
|
||||||
|
// FIXME this disables unloading so TouchNode wouldn't try to double-lock
|
||||||
|
cache.DisableUnloading()
|
||||||
cache.Lock()
|
cache.Lock()
|
||||||
for _, room := range cache.Map {
|
for _, room := range cache.Map {
|
||||||
if !room.Encrypted {
|
if !room.Encrypted {
|
||||||
@ -85,6 +87,7 @@ func (cache *RoomCache) FindSharedRooms(userID id.UserID) (shared []id.RoomID) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
cache.Unlock()
|
cache.Unlock()
|
||||||
|
cache.EnableUnloading()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user