mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-19 12:47:06 +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 {
|
if clients, _, ok := s.LongConnServer.GetUserPlatformCons(v, int(req.PlatformID)); ok {
|
||||||
for _, client := range clients {
|
for _, client := range clients {
|
||||||
log.ZDebug(ctx, "kick user offline", "userID", v, "platformID", req.PlatformID, "client", client)
|
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)
|
log.ZWarn(ctx, "kick user offline failed", err, "userID", v, "platformID", req.PlatformID)
|
||||||
}
|
}
|
||||||
// s.LongConnServer.UserLogout()
|
|
||||||
// s.LongConnServer.UnRegister(client)
|
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
return &msggateway.KickUserOfflineResp{}, nil
|
||||||
|
|||||||
@ -47,7 +47,7 @@ type LongConnServer interface {
|
|||||||
Validate(s interface{}) error
|
Validate(s interface{}) error
|
||||||
SetCacheHandler(cache cache.MsgModel)
|
SetCacheHandler(cache cache.MsgModel)
|
||||||
SetDiscoveryRegistry(client discoveryregistry.SvcDiscoveryRegistry)
|
SetDiscoveryRegistry(client discoveryregistry.SvcDiscoveryRegistry)
|
||||||
KickUserConn(userID string, client *Client) error
|
KickUserConn(client *Client) error
|
||||||
UnRegister(c *Client)
|
UnRegister(c *Client)
|
||||||
Compressor
|
Compressor
|
||||||
Encoder
|
Encoder
|
||||||
@ -208,8 +208,8 @@ func getRemoteAdders(client []*Client) string {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ws *WsServer) KickUserConn(userID string, client *Client) error {
|
func (ws *WsServer) KickUserConn(client *Client) error {
|
||||||
ws.clients.deleteClients(userID, []*Client{client})
|
ws.clients.deleteClients(client.UserID, []*Client{client})
|
||||||
return client.KickOnlineMessage()
|
return client.KickOnlineMessage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user