mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-03 12:13:09 -06:00
Take map lock
This commit is contained in:
parent
3c73ec6b9f
commit
68c1a13195
|
|
@ -250,6 +250,8 @@ func (n *Notifier) OnNewPresence(
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Notifier) SharedUsers(userID string) (sharedUsers []string) {
|
func (n *Notifier) SharedUsers(userID string) (sharedUsers []string) {
|
||||||
|
n.mapLock.RLock()
|
||||||
|
defer n.mapLock.RUnlock()
|
||||||
for roomID, users := range n.roomIDToJoinedUsers {
|
for roomID, users := range n.roomIDToJoinedUsers {
|
||||||
if _, ok := users[userID]; ok {
|
if _, ok := users[userID]; ok {
|
||||||
sharedUsers = append(sharedUsers, n.JoinedUsers(roomID)...)
|
sharedUsers = append(sharedUsers, n.JoinedUsers(roomID)...)
|
||||||
|
|
@ -259,6 +261,8 @@ func (n *Notifier) SharedUsers(userID string) (sharedUsers []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Notifier) IsSharedUser(userA, userB string) bool {
|
func (n *Notifier) IsSharedUser(userA, userB string) bool {
|
||||||
|
n.mapLock.RLock()
|
||||||
|
defer n.mapLock.RUnlock()
|
||||||
var okA, okB bool
|
var okA, okB bool
|
||||||
for _, users := range n.roomIDToJoinedUsers {
|
for _, users := range n.roomIDToJoinedUsers {
|
||||||
_, okA = users[userA]
|
_, okA = users[userA]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue