Sfoglia il codice sorgente

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
tags/v0.11.0-beta
Shivaram Lingamneni 6 anni fa
parent
commit
b8f37e4e6c
1 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  1. 7
    0
      irc/idletimer.go

+ 7
- 0
irc/idletimer.go Vedi File

@@ -179,6 +179,7 @@ type NickTimer struct {
179 179
 	client  *Client
180 180
 
181 181
 	// mutable
182
+	stopped        bool
182 183
 	nick           string
183 184
 	accountForNick string
184 185
 	account        string
@@ -213,6 +214,11 @@ func (nt *NickTimer) Touch() {
213 214
 	func() {
214 215
 		nt.Lock()
215 216
 		defer nt.Unlock()
217
+
218
+		if nt.stopped {
219
+			return
220
+		}
221
+
216 222
 		// the timer will not reset as long as the squatter is targeting the same account
217 223
 		accountChanged := accountForNick != nt.accountForNick
218 224
 		// change state
@@ -248,6 +254,7 @@ func (nt *NickTimer) Stop() {
248 254
 		nt.timer.Stop()
249 255
 		nt.timer = nil
250 256
 	}
257
+	nt.stopped = true
251 258
 }
252 259
 
253 260
 func (nt *NickTimer) sendWarning() {

Loading…
Annulla
Salva