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
1 changed files with 7 additions and 0 deletions

View File

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