Fix concurrent map read-write for user perms
This commit is contained in:
parent
8b3710579e
commit
6fc7f6e1d7
2
modes.go
2
modes.go
@ -422,6 +422,8 @@ func (p *UserPerms) MarshalJSON() ([]byte, error) {
|
|||||||
// Lookup looks up the users permissions for a given channel. ok is false
|
// Lookup looks up the users permissions for a given channel. ok is false
|
||||||
// if the user is not in the given channel.
|
// if the user is not in the given channel.
|
||||||
func (p *UserPerms) Lookup(channel string) (perms Perms, ok bool) {
|
func (p *UserPerms) Lookup(channel string) (perms Perms, ok bool) {
|
||||||
|
p.mu.RLock()
|
||||||
|
defer p.mu.RUnlock()
|
||||||
perms, ok = p.channels[ToRFC1459(channel)]
|
perms, ok = p.channels[ToRFC1459(channel)]
|
||||||
|
|
||||||
return perms, ok
|
return perms, ok
|
||||||
|
Loading…
Reference in New Issue
Block a user