Browse Source

Warn on shutdown failure only if connected to irc

master
Tyler Sommer 9 months ago
parent
commit
54a998ca29
Signed by: tyler-sommer
GPG Key ID: C09C010500DBD008
  1. 4
      irc/irc.go
  2. 4
      irc/plugin.go

4
irc/irc.go

@ -14,6 +14,8 @@ import (
"code.dopame.me/veonik/squircy3/event"
)
var ErrNotConnected = errors.New("not connected")
type Config struct {
Nick string `toml:"nick"`
Username string `toml:"user"`
@ -225,7 +227,7 @@ func (m *Manager) Disconnect() error {
conn := m.conn
m.mu.RUnlock()
if conn == nil {
return errors.New("not connected")
return ErrNotConnected
}
return conn.Quit()
}

4
irc/plugin.go

@ -66,7 +66,9 @@ func (p *ircPlugin) HandleShutdown() {
return
}
if err := p.manager.Disconnect(); err != nil {
logrus.Warnln("irc: failed to disconnect before shutting down:", err)
if err != ErrNotConnected {
logrus.Warnln("irc: failed to disconnect before shutting down:", err)
}
}
}

Loading…
Cancel
Save