Skip to content

Commit

Permalink
Merge pull request #2151 from slingamn/modes_forwardport
Browse files Browse the repository at this point in the history
fix deadlock on channel state mutex
  • Loading branch information
slingamn authored May 6, 2024
2 parents ccc362b + 6abb291 commit ca4b9c1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions irc/getters.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,11 @@ func (channel *Channel) Founder() string {

func (channel *Channel) HighestUserMode(client *Client) (result modes.Mode) {
channel.stateMutex.RLock()
clientModes := channel.members[client].modes
channel.stateMutex.RUnlock()
return clientModes.HighestChannelUserMode()
defer channel.stateMutex.RUnlock()
if clientData, ok := channel.members[client]; ok {
return clientData.modes.HighestChannelUserMode()
}
return
}

func (channel *Channel) Settings() (result ChannelSettings) {
Expand Down

0 comments on commit ca4b9c1

Please sign in to comment.