summaryrefslogtreecommitdiff
path: root/irc/states.go
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtzfr.eu>2020-08-19 15:17:53 +0200
committerHubert Hirtz <hubert@hirtzfr.eu>2020-08-19 21:56:39 +0200
commit4d806b75e2a903a725069b23df555714122974e6 (patch)
tree33d0baa546bd9c5ec95819d8ce798ed25bd9498e /irc/states.go
parentui: Show self /msg and /r even if echo-message is off (diff)
Properly close everything in case of error
Diffstat (limited to 'irc/states.go')
-rw-r--r--irc/states.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/irc/states.go b/irc/states.go
index d826d7d..762ed71 100644
--- a/irc/states.go
+++ b/irc/states.go
@@ -214,8 +214,14 @@ func (s *Session) Running() bool {
}
func (s *Session) Stop() {
+ if !s.Running() {
+ return
+ }
s.running.Store(false)
_ = s.conn.Close()
+ close(s.acts)
+ close(s.evts)
+ close(s.msgs)
}
func (s *Session) Poll() (events <-chan Event) {