3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

fix bad interaction between nickTimer.Stop() and accounts.Logout()

Sequence of events:

1. client.nickTimer.Stop()
2. client.server.accounts.Logout(client)
3. accounts sees that client is no longer logged in, does client.nickTimer.Touch()
4. 30 seconds later, RandomlyRename resurrects the zombie client
This commit is contained in:
Shivaram Lingamneni 2018-03-14 08:43:50 -04:00
parent fd34c78d6b
commit b8f37e4e6c

View File

@ -179,6 +179,7 @@ type NickTimer struct {
client *Client client *Client
// mutable // mutable
stopped bool
nick string nick string
accountForNick string accountForNick string
account string account string
@ -213,6 +214,11 @@ func (nt *NickTimer) Touch() {
func() { func() {
nt.Lock() nt.Lock()
defer nt.Unlock() defer nt.Unlock()
if nt.stopped {
return
}
// the timer will not reset as long as the squatter is targeting the same account // the timer will not reset as long as the squatter is targeting the same account
accountChanged := accountForNick != nt.accountForNick accountChanged := accountForNick != nt.accountForNick
// change state // change state
@ -248,6 +254,7 @@ func (nt *NickTimer) Stop() {
nt.timer.Stop() nt.timer.Stop()
nt.timer = nil nt.timer = nil
} }
nt.stopped = true
} }
func (nt *NickTimer) sendWarning() { func (nt *NickTimer) sendWarning() {