From dcf501751ab79e9bafb85244643e7af1121c806e Mon Sep 17 00:00:00 2001 From: delthas Date: Fri, 16 Dec 2022 11:47:57 +0100 Subject: 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. --- irc/typing.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/irc/typing.go b/irc/typing.go index 4a8cf55..128f83d 100644 --- a/irc/typing.go +++ b/irc/typing.go @@ -72,9 +72,10 @@ func (ts *Typings) Active(target, name string) { time.Sleep(6 * time.Second) ts.l.Lock() - defer ts.l.Unlock() + closed := ts.closed + ts.l.Unlock() - if !ts.closed { + if !closed { ts.timeouts <- t } }() -- cgit v1.2.3