Fix race condition with NICK and QUIT when multiple dispatch users are in the same channel

This commit is contained in:
Ken-Håvard Lieng 2017-04-11 03:49:52 +02:00
parent 3393b1b706
commit 18651c1a10
8 changed files with 145 additions and 138 deletions

View file

@ -57,10 +57,9 @@ func (i *ircHandler) dispatchMessage(msg *irc.Message) {
func (i *ircHandler) nick(msg *irc.Message) {
i.session.sendJSON("nick", Nick{
Server: i.client.Host,
Old: msg.Nick,
New: msg.LastParam(),
Channels: channelStore.FindUserChannels(msg.Nick, i.client.Host),
Server: i.client.Host,
Old: msg.Nick,
New: msg.LastParam(),
})
channelStore.RenameUser(msg.Nick, msg.LastParam(), i.client.Host)
@ -138,10 +137,9 @@ func (i *ircHandler) message(msg *irc.Message) {
func (i *ircHandler) quit(msg *irc.Message) {
i.session.sendJSON("quit", Quit{
Server: i.client.Host,
User: msg.Nick,
Reason: msg.LastParam(),
Channels: channelStore.FindUserChannels(msg.Nick, i.client.Host),
Server: i.client.Host,
User: msg.Nick,
Reason: msg.LastParam(),
})
channelStore.RemoveUserAll(msg.Nick, i.client.Host)