add reconnect irc

This commit is contained in:
Jay 2018-09-24 20:28:24 +08:00
parent c2b96c69d1
commit 06ac36b91d

View File

@ -23,6 +23,9 @@ func InitIRC() {
conn, err := tls.Dial("tcp", conf.Twitch.ChatHost, tlsConf) conn, err := tls.Dial("tcp", conf.Twitch.ChatHost, tlsConf)
// conn, err := net.Dial("tcp", conf.Twitch.ChatHost) // conn, err := net.Dial("tcp", conf.Twitch.ChatHost)
if err != nil { if err != nil {
fmt.Println("create irc connect fail ", err)
time.Sleep(time.Second * 3)
go InitIRC()
return return
} }
defer conn.Close() defer conn.Close()
@ -49,6 +52,7 @@ func InitIRC() {
channels = channels[:0] channels = channels[:0]
queue.Clear() queue.Clear()
go InitIRC() go InitIRC()
return
} }
} }