diff options
author | Tulir Asokan <tulir@maunium.net> | 2020-05-06 18:43:35 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2020-05-06 18:43:35 +0300 |
commit | 4052ec532b7f963ef738f8c5fb0b32759571e8f5 (patch) | |
tree | bad7c9f8fceed6ecd3c7f7d66c62c4a5fd73aeed | |
parent | 5927733562b401364d9df6dd9b40e82f654d0d3d (diff) |
Fix potential double locking when finding shared rooms
-rw-r--r-- | matrix/rooms/roomcache.go | 3 |
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 } |