1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-12 06:45:46 +08:00
This commit is contained in:
Mrs4s 2020-08-15 16:07:56 +08:00
parent f325b26e1a
commit 1a1f860dbe

View File

@ -179,11 +179,9 @@ func (c *websocketClient) listenApi(conn *wsc.Conn, u bool) {
}
if c.conf.ReverseReconnectInterval != 0 {
time.Sleep(time.Millisecond * time.Duration(c.conf.ReverseReconnectInterval))
if u {
c.connectUniversal()
return
if !u {
c.connectApi()
}
c.connectApi()
}
}
@ -204,7 +202,15 @@ func (c *websocketClient) onBotPushEvent(m coolq.MSG) {
}
if c.universalConn != nil {
log.Debugf("向WS服务器 %v 推送Event: %v", c.universalConn.RemoteAddr().String(), m.ToJson())
_, _ = c.universalConn.Write([]byte(m.ToJson()))
if _, err := c.universalConn.Write([]byte(m.ToJson())); err != nil {
_ = c.universalConn.Close()
if c.conf.ReverseReconnectInterval != 0 {
go func() {
time.Sleep(time.Millisecond * time.Duration(c.conf.ReverseReconnectInterval))
c.connectUniversal()
}()
}
}
}
}