aboutsummaryrefslogtreecommitdiff
path: root/matrix/rooms
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2020-05-06 18:43:35 +0300
committerTulir Asokan <tulir@maunium.net>2020-05-06 18:43:35 +0300
commit4052ec532b7f963ef738f8c5fb0b32759571e8f5 (patch)
treebad7c9f8fceed6ecd3c7f7d66c62c4a5fd73aeed /matrix/rooms
parent5927733562b401364d9df6dd9b40e82f654d0d3d (diff)
Fix potential double locking when finding shared rooms
Diffstat (limited to 'matrix/rooms')
-rw-r--r--matrix/rooms/roomcache.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/matrix/rooms/roomcache.go b/matrix/rooms/roomcache.go
index d66078c..067cbb6 100644
--- a/matrix/rooms/roomcache.go
+++ b/matrix/rooms/roomcache.go
@@ -74,6 +74,8 @@ func (cache *RoomCache) IsEncrypted(roomID id.RoomID) bool {
}
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()
for _, room := range cache.Map {
if !room.Encrypted {
@@ -85,6 +87,7 @@ func (cache *RoomCache) FindSharedRooms(userID id.UserID) (shared []id.RoomID) {
}
}
cache.Unlock()
+ cache.EnableUnloading()
return
}