diff options
author | delthas <delthas@dille.cc> | 2022-12-16 11:47:57 +0100 |
---|---|---|
committer | delthas <delthas@dille.cc> | 2022-12-16 11:47:57 +0100 |
commit | dcf501751ab79e9bafb85244643e7af1121c806e (patch) | |
tree | 4e1ef5f5e06f3ab9d383015aa0d5c65df808f7d2 | |
parent | Fix processing CHATHISTORY TAGMSG as standalone messages (diff) |
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.
-rw-r--r-- | irc/typing.go | 5 |
1 files 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 } }() |