commit 159853d

delthas  ·  2022-02-26 19:59:46 +0000 UTC
parent a9e0ae5
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.
1 files changed,  +5, -0
M app.go
M app.go
+5, -0
 1@@ -241,6 +241,11 @@ func (app *App) eventLoop() {
 2 			app.win.Draw(currentMembers)
 3 		}
 4 	}
 5+	go func() {
 6+		// drain events until we close
 7+		for range app.events {
 8+		}
 9+	}()
10 }
11 
12 // ircLoop maintains a connection to the IRC server by connecting and then