|
|
@ -11,6 +11,7 @@ import (
|
|
|
|
pbRelay "Open_IM/pkg/proto/relay"
|
|
|
|
pbRelay "Open_IM/pkg/proto/relay"
|
|
|
|
"Open_IM/pkg/utils"
|
|
|
|
"Open_IM/pkg/utils"
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"errors"
|
|
|
|
"net"
|
|
|
|
"net"
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
@ -81,11 +82,16 @@ func (rpc *rpcAuth) ForceLogout(_ context.Context, req *pbAuth.ForceLogoutReq) (
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (rpc *rpcAuth) forceKickOff(userID string, platformID int32, operationID string) error {
|
|
|
|
func (rpc *rpcAuth) forceKickOff(userID string, platformID int32, operationID string) error {
|
|
|
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
|
|
|
|
|
|
|
|
client := pbRelay.NewOnlineMessageRelayServiceClient(etcdConn)
|
|
|
|
grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
|
|
|
|
kickReq := &pbRelay.KickUserOfflineReq{OperationID: operationID, KickUserIDList: []string{userID}, PlatformID: platformID}
|
|
|
|
for _, v := range grpcCons {
|
|
|
|
_, err := client.KickUserOffline(context.Background(), kickReq)
|
|
|
|
client := pbRelay.NewOnlineMessageRelayServiceClient(v)
|
|
|
|
return utils.Wrap(err, "")
|
|
|
|
kickReq := &pbRelay.KickUserOfflineReq{OperationID: operationID, KickUserIDList: []string{userID}, PlatformID: platformID}
|
|
|
|
|
|
|
|
_, err := client.KickUserOffline(context.Background(), kickReq)
|
|
|
|
|
|
|
|
return utils.Wrap(err, "")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return errors.New("no rpc node ")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type rpcAuth struct {
|
|
|
|
type rpcAuth struct {
|
|
|
|