commit dcf5017
delthas
·
2022-12-16 10:47:57 +0000 UTC
parent 7b9b1fc
Prevent possible deadlock in the typing system When being flooded by typing notifications, we could steal the lock from the routine supposed to empty the notification channel. This caused a possible deadlock in rare cases.
1 files changed,
+3,
-2
+3,
-2
1@@ -72,9 +72,10 @@ func (ts *Typings) Active(target, name string) {
2 time.Sleep(6 * time.Second)
3
4 ts.l.Lock()
5- defer ts.l.Unlock()
6+ closed := ts.closed
7+ ts.l.Unlock()
8
9- if !ts.closed {
10+ if !closed {
11 ts.timeouts <- t
12 }
13 }()