1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-04 19:17:37 +08:00

fix(server): fix Mutex change in reconnect

This commit is contained in:
wdvxdr 2021-12-26 15:48:08 +08:00
parent ef2223828f
commit 80e35fc800
No known key found for this signature in database
GPG Key ID: 703F8C071DE7A1B6

View File

@ -270,13 +270,21 @@ func (c *websocketClient) connect(typ, url string, conptr **wsConn) {
}
log.Infof("已连接到反向WebSocket %s服务器 %v", typ, url)
wrappedConn := &wsConn{conn: conn, apiCaller: api.NewCaller(c.bot)}
if c.limiter != nil {
wrappedConn.apiCaller.Use(c.limiter)
var wrappedConn *wsConn
if conptr != nil && *conptr != nil {
wrappedConn = *conptr
} else {
wrappedConn = new(wsConn)
if conptr != nil {
*conptr = wrappedConn
}
}
if conptr != nil {
*conptr = wrappedConn
wrappedConn.conn = conn
wrappedConn.apiCaller = api.NewCaller(c.bot)
if c.limiter != nil {
wrappedConn.apiCaller.Use(c.limiter)
}
if typ != "Event" {