mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-07-12 00:23:47 +00:00
fix(server): fix Mutex change in reconnect
This commit is contained in:
@ -270,14 +270,22 @@ func (c *websocketClient) connect(typ, url string, conptr **wsConn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Infof("已连接到反向WebSocket %s服务器 %v", typ, url)
|
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 {
|
if conptr != nil {
|
||||||
*conptr = wrappedConn
|
*conptr = wrappedConn
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wrappedConn.conn = conn
|
||||||
|
wrappedConn.apiCaller = api.NewCaller(c.bot)
|
||||||
|
if c.limiter != nil {
|
||||||
|
wrappedConn.apiCaller.Use(c.limiter)
|
||||||
|
}
|
||||||
|
|
||||||
if typ != "Event" {
|
if typ != "Event" {
|
||||||
go c.listenAPI(typ, url, wrappedConn)
|
go c.listenAPI(typ, url, wrappedConn)
|
||||||
|
Reference in New Issue
Block a user