Browse Source

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 years ago
parent
commit
b8f37e4e6c
1 changed files with 7 additions and 0 deletions
  1. 7
    0
      irc/idletimer.go

+ 7
- 0
irc/idletimer.go View File

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

Loading…
Cancel
Save