client: Unlock channel mutex earlier

This commit is contained in:
Daniel Oaks 2017-03-24 21:54:06 +10:00
parent e34475d536
commit aad1070633
1 changed files with 1 additions and 1 deletions

View File

@ -332,7 +332,6 @@ func (client *Client) Friends(Capabilities ...Capability) ClientSet {
for channel := range client.channels {
channel.membersMutex.RLock()
defer channel.membersMutex.RUnlock()
for member := range channel.members {
// make sure they have all the required caps
for _, Cap := range Capabilities {
@ -342,6 +341,7 @@ func (client *Client) Friends(Capabilities ...Capability) ClientSet {
}
friends.Add(member)
}
channel.membersMutex.RUnlock()
}
return friends
}