fix: sync close ws conn when kick old user avoid wrong trigger order about online status. (#1368)

pull/1374/head
Gordon 1 year ago committed by GitHub
parent 3ba861fd90
commit b562da5c37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -297,7 +297,9 @@ func (c *Client) KickOnlineMessage() error {
resp := Resp{
ReqIdentifier: WSKickOnlineMsg,
}
return c.writeBinaryMsg(resp)
err := c.writeBinaryMsg(resp)
c.close()
return err
}
func (c *Client) writeBinaryMsg(resp Resp) error {

@ -225,12 +225,7 @@ func (ws *WsServer) registerClient(client *Client) {
ws.onlineUserNum.Add(1)
ws.onlineUserConnNum.Add(1)
} else {
i := &kickHandler{
clientOK: clientOK,
oldClients: oldClients,
newClient: client,
}
ws.kickHandlerChan <- i
ws.multiTerminalLoginChecker(clientOK, oldClients, client)
log.ZDebug(client.ctx, "user exist", "userID", client.UserID, "platformID", client.PlatformID)
if clientOK {
ws.clients.Set(client.UserID, client)

Loading…
Cancel
Save