diff --git a/internal/msggateway/n_ws_server.go b/internal/msggateway/n_ws_server.go index 9fdf52163..07924f0f2 100644 --- a/internal/msggateway/n_ws_server.go +++ b/internal/msggateway/n_ws_server.go @@ -161,7 +161,7 @@ func (ws *WsServer) multiTerminalLoginChecker(client []*Client) { } func (ws *WsServer) unregisterClient(client *Client) { defer ws.clientPool.Put(client) - isDeleteUser := ws.clients.delete(client.userID, client.platformID) + isDeleteUser := ws.clients.delete(client.userID, client.ctx.GetRemoteAddr()) if isDeleteUser { atomic.AddInt64(&ws.onlineUserNum, -1) } diff --git a/internal/msggateway/user_map.go b/internal/msggateway/user_map.go index 9f14bb3de..c173d8e05 100644 --- a/internal/msggateway/user_map.go +++ b/internal/msggateway/user_map.go @@ -51,13 +51,13 @@ func (u *UserMap) Set(key string, v *Client) { u.m.Store(key, clients) } } -func (u *UserMap) delete(key string, platformID int) (isDeleteUser bool) { +func (u *UserMap) delete(key string, connRemoteAddr string) (isDeleteUser bool) { allClients, existed := u.m.Load(key) if existed { oldClients := allClients.([]*Client) var a []*Client for _, client := range oldClients { - if client.platformID != platformID { + if client.ctx.GetRemoteAddr() != connRemoteAddr { a = append(a, client) } }