summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordelthas <delthas@dille.cc>2022-02-26 20:59:46 +0100
committerdelthas <delthas@dille.cc>2022-02-26 20:59:46 +0100
commit159853d7c369a67ef533e29a75e2a84b9cc5aa14 (patch)
tree779de41d014647ea4aec7c696e8818e6154b2781
parentUse delthas/tcell fork (diff)
Drain the events channel when closing
This avoids rare cases where we try to send messages to the event channel, but it is full and blocks the Close routine.
-rw-r--r--app.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/app.go b/app.go
index 485521f..3b34bd8 100644
--- a/app.go
+++ b/app.go
@@ -241,6 +241,11 @@ func (app *App) eventLoop() {
app.win.Draw(currentMembers)
}
}
+ go func() {
+ // drain events until we close
+ for range app.events {
+ }
+ }()
}
// ircLoop maintains a connection to the IRC server by connecting and then