mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-19 20:57:03 +08:00
fix bug: multiple gateway kick user
This commit is contained in:
parent
afc7efd5a9
commit
d92f358a67
@ -181,14 +181,12 @@ func (s *Server) KickUserOffline(
|
||||
if clients, _, ok := s.LongConnServer.GetUserPlatformCons(v, int(req.PlatformID)); ok {
|
||||
for _, client := range clients {
|
||||
log.ZDebug(ctx, "kick user offline", "userID", v, "platformID", req.PlatformID, "client", client)
|
||||
if err := client.longConnServer.KickUserConn(v, client); err != nil {
|
||||
if err := client.longConnServer.KickUserConn(client); err != nil {
|
||||
log.ZWarn(ctx, "kick user offline failed", err, "userID", v, "platformID", req.PlatformID)
|
||||
}
|
||||
// s.LongConnServer.UserLogout()
|
||||
// s.LongConnServer.UnRegister(client)
|
||||
}
|
||||
} else {
|
||||
log.ZInfo(ctx, "conn not exist", nil, "userID", v, "platformID", req.PlatformID)
|
||||
log.ZInfo(ctx, "conn not exist", "userID", v, "platformID", req.PlatformID)
|
||||
}
|
||||
}
|
||||
return &msggateway.KickUserOfflineResp{}, nil
|
||||
|
||||
@ -47,7 +47,7 @@ type LongConnServer interface {
|
||||
Validate(s interface{}) error
|
||||
SetCacheHandler(cache cache.MsgModel)
|
||||
SetDiscoveryRegistry(client discoveryregistry.SvcDiscoveryRegistry)
|
||||
KickUserConn(userID string, client *Client) error
|
||||
KickUserConn(client *Client) error
|
||||
UnRegister(c *Client)
|
||||
Compressor
|
||||
Encoder
|
||||
@ -208,8 +208,8 @@ func getRemoteAdders(client []*Client) string {
|
||||
return ret
|
||||
}
|
||||
|
||||
func (ws *WsServer) KickUserConn(userID string, client *Client) error {
|
||||
ws.clients.deleteClients(userID, []*Client{client})
|
||||
func (ws *WsServer) KickUserConn(client *Client) error {
|
||||
ws.clients.deleteClients(client.UserID, []*Client{client})
|
||||
return client.KickOnlineMessage()
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user