mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 21:39:25 +01:00
fix data race on exitedSnomaskSent
This commit is contained in:
parent
1a7169d75d
commit
5ac7ea5b1c
@ -987,6 +987,7 @@ func (client *Client) destroy(session *Session) {
|
|||||||
// if it's our job to destroy it, don't let anyone else try
|
// if it's our job to destroy it, don't let anyone else try
|
||||||
client.destroyed = true
|
client.destroyed = true
|
||||||
}
|
}
|
||||||
|
exitedSnomaskSent := client.exitedSnomaskSent
|
||||||
client.stateMutex.Unlock()
|
client.stateMutex.Unlock()
|
||||||
|
|
||||||
// destroy all applicable sessions:
|
// 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)
|
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))
|
client.server.snomasks.Send(sno.LocalQuits, fmt.Sprintf(ircfmt.Unescape("%s$r exited the network"), details.nick))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,6 +187,12 @@ func (client *Client) SetAway(away bool, awayMessage string) (changed bool) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (client *Client) SetExitedSnomaskSent() {
|
||||||
|
client.stateMutex.Lock()
|
||||||
|
client.exitedSnomaskSent = true
|
||||||
|
client.stateMutex.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
// uniqueIdentifiers returns the strings for which the server enforces per-client
|
// uniqueIdentifiers returns the strings for which the server enforces per-client
|
||||||
// uniqueness/ownership; no two clients can have colliding casefolded nicks or
|
// uniqueness/ownership; no two clients can have colliding casefolded nicks or
|
||||||
// skeletons.
|
// skeletons.
|
||||||
|
@ -1052,7 +1052,7 @@ func dlineHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Res
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, mcl := range clientsToKill {
|
for _, mcl := range clientsToKill {
|
||||||
mcl.exitedSnomaskSent = true
|
mcl.SetExitedSnomaskSent()
|
||||||
mcl.Quit(fmt.Sprintf(mcl.t("You have been banned from this server (%s)"), reason), nil)
|
mcl.Quit(fmt.Sprintf(mcl.t("You have been banned from this server (%s)"), reason), nil)
|
||||||
if mcl == client {
|
if mcl == client {
|
||||||
killClient = true
|
killClient = true
|
||||||
@ -1362,7 +1362,7 @@ func killHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
|||||||
quitMsg := fmt.Sprintf("Killed (%s (%s))", client.nick, comment)
|
quitMsg := fmt.Sprintf("Killed (%s (%s))", client.nick, comment)
|
||||||
|
|
||||||
server.snomasks.Send(sno.LocalKills, fmt.Sprintf(ircfmt.Unescape("%s$r was killed by %s $c[grey][$r%s$c[grey]]"), target.nick, client.nick, comment))
|
server.snomasks.Send(sno.LocalKills, fmt.Sprintf(ircfmt.Unescape("%s$r was killed by %s $c[grey][$r%s$c[grey]]"), target.nick, client.nick, comment))
|
||||||
target.exitedSnomaskSent = true
|
target.SetExitedSnomaskSent()
|
||||||
|
|
||||||
target.Quit(quitMsg, nil)
|
target.Quit(quitMsg, nil)
|
||||||
target.destroy(nil)
|
target.destroy(nil)
|
||||||
@ -1489,7 +1489,7 @@ func klineHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Res
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, mcl := range clientsToKill {
|
for _, mcl := range clientsToKill {
|
||||||
mcl.exitedSnomaskSent = true
|
mcl.SetExitedSnomaskSent()
|
||||||
mcl.Quit(fmt.Sprintf(mcl.t("You have been banned from this server (%s)"), reason), nil)
|
mcl.Quit(fmt.Sprintf(mcl.t("You have been banned from this server (%s)"), reason), nil)
|
||||||
if mcl == client {
|
if mcl == client {
|
||||||
killClient = true
|
killClient = true
|
||||||
|
Loading…
Reference in New Issue
Block a user