Commit 1a1f860d authored by Mrs4s's avatar Mrs4s

fix #108.

parent f325b26e
......@@ -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()
}()
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment