1
0
Fork 0
forked from External/ergo

fix data race on exitedSnomaskSent

This commit is contained in:
Shivaram Lingamneni 2019-05-27 14:33:59 -04:00
parent 1a7169d75d
commit 5ac7ea5b1c
3 changed files with 11 additions and 4 deletions

View file

@ -987,6 +987,7 @@ func (client *Client) destroy(session *Session) {
// if it's our job to destroy it, don't let anyone else try
client.destroyed = true
}
exitedSnomaskSent := client.exitedSnomaskSent
client.stateMutex.Unlock()
// destroy all applicable sessions:
@ -1101,7 +1102,7 @@ func (client *Client) destroy(session *Session) {
friend.sendFromClientInternal(false, splitQuitMessage.Time, splitQuitMessage.Msgid, details.nickMask, details.accountName, nil, "QUIT", quitMessage)
}
if !client.exitedSnomaskSent && registered {
if !exitedSnomaskSent && registered {
client.server.snomasks.Send(sno.LocalQuits, fmt.Sprintf(ircfmt.Unescape("%s$r exited the network"), details.nick))
}
}