Fix concurrent map read-write for user perms

This commit is contained in:
kayos@tcp.direct 2022-03-19 18:06:16 -07:00
parent 8b3710579e
commit 6fc7f6e1d7
Signed by: kayos
GPG Key ID: 4B841471B4BEE979

View File

@ -422,6 +422,8 @@ func (p *UserPerms) MarshalJSON() ([]byte, error) {
// Lookup looks up the users permissions for a given channel. ok is false
// if the user is not in the given channel.
func (p *UserPerms) Lookup(channel string) (perms Perms, ok bool) {
p.mu.RLock()
defer p.mu.RUnlock()
perms, ok = p.channels[ToRFC1459(channel)]
return perms, ok