mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-24 02:16:16 +08:00
Rpc Register IP
This commit is contained in:
parent
e4d35c2a86
commit
218340e138
@ -55,7 +55,7 @@ func (r *RPCServer) run() {
|
|||||||
defer srv.GracefulStop()
|
defer srv.GracefulStop()
|
||||||
pbRelay.RegisterOnlineMessageRelayServiceServer(srv, r)
|
pbRelay.RegisterOnlineMessageRelayServiceServer(srv, r)
|
||||||
|
|
||||||
rpcRegisterIP := ""
|
rpcRegisterIP := config.Config.RpcRegisterIP
|
||||||
if config.Config.RpcRegisterIP == "" {
|
if config.Config.RpcRegisterIP == "" {
|
||||||
rpcRegisterIP, err = utils.GetLocalIP()
|
rpcRegisterIP, err = utils.GetLocalIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -291,9 +291,11 @@ func (r *RPCServer) KickUserOffline(_ context.Context, req *pbRelay.KickUserOffl
|
|||||||
for _, v := range req.KickUserIDList {
|
for _, v := range req.KickUserIDList {
|
||||||
oldConnMap := ws.getUserAllCons(v)
|
oldConnMap := ws.getUserAllCons(v)
|
||||||
if conn, ok := oldConnMap[int(req.PlatformID)]; ok { // user->map[platform->conn]
|
if conn, ok := oldConnMap[int(req.PlatformID)]; ok { // user->map[platform->conn]
|
||||||
|
log.NewWarn(req.OperationID, "send kick msg, close connection ", req.PlatformID, v)
|
||||||
ws.sendKickMsg(conn, &UserConn{})
|
ws.sendKickMsg(conn, &UserConn{})
|
||||||
conn.Close()
|
conn.Close()
|
||||||
}
|
}
|
||||||
|
log.NewWarn(req.OperationID, "SetTokenKicked ", v, req.PlatformID, req.OperationID)
|
||||||
SetTokenKicked(v, int(req.PlatformID), req.OperationID)
|
SetTokenKicked(v, int(req.PlatformID), req.OperationID)
|
||||||
}
|
}
|
||||||
return &pbRelay.KickUserOfflineResp{}, nil
|
return &pbRelay.KickUserOfflineResp{}, nil
|
||||||
|
@ -44,7 +44,7 @@ func (r *RPCServer) run() {
|
|||||||
srv := grpc.NewServer()
|
srv := grpc.NewServer()
|
||||||
defer srv.GracefulStop()
|
defer srv.GracefulStop()
|
||||||
pbPush.RegisterPushMsgServiceServer(srv, r)
|
pbPush.RegisterPushMsgServiceServer(srv, r)
|
||||||
rpcRegisterIP := ""
|
rpcRegisterIP := config.Config.RpcRegisterIP
|
||||||
if config.Config.RpcRegisterIP == "" {
|
if config.Config.RpcRegisterIP == "" {
|
||||||
rpcRegisterIP, err = utils.GetLocalIP()
|
rpcRegisterIP, err = utils.GetLocalIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -56,7 +56,7 @@ func (s *adminCMSServer) Run() {
|
|||||||
defer srv.GracefulStop()
|
defer srv.GracefulStop()
|
||||||
//Service registers with etcd
|
//Service registers with etcd
|
||||||
pbAdminCMS.RegisterAdminCMSServer(srv, s)
|
pbAdminCMS.RegisterAdminCMSServer(srv, s)
|
||||||
rpcRegisterIP := ""
|
rpcRegisterIP := config.Config.RpcRegisterIP
|
||||||
if config.Config.RpcRegisterIP == "" {
|
if config.Config.RpcRegisterIP == "" {
|
||||||
rpcRegisterIP, err = utils.GetLocalIP()
|
rpcRegisterIP, err = utils.GetLocalIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -134,7 +134,7 @@ func (rpc *rpcAuth) Run() {
|
|||||||
|
|
||||||
//service registers with etcd
|
//service registers with etcd
|
||||||
pbAuth.RegisterAuthServer(srv, rpc)
|
pbAuth.RegisterAuthServer(srv, rpc)
|
||||||
rpcRegisterIP := ""
|
rpcRegisterIP := config.Config.RpcRegisterIP
|
||||||
if config.Config.RpcRegisterIP == "" {
|
if config.Config.RpcRegisterIP == "" {
|
||||||
rpcRegisterIP, err = utils.GetLocalIP()
|
rpcRegisterIP, err = utils.GetLocalIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -142,6 +142,7 @@ func (rpc *rpcAuth) Run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.NewInfo("", "rpcRegisterIP", rpcRegisterIP)
|
log.NewInfo("", "rpcRegisterIP", rpcRegisterIP)
|
||||||
|
|
||||||
err = getcdv3.RegisterEtcd(rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), rpcRegisterIP, rpc.rpcPort, rpc.rpcRegisterName, 10)
|
err = getcdv3.RegisterEtcd(rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), rpcRegisterIP, rpc.rpcPort, rpc.rpcRegisterName, 10)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(operationID, "RegisterEtcd failed ", err.Error(),
|
log.NewError(operationID, "RegisterEtcd failed ", err.Error(),
|
||||||
|
2
internal/rpc/cache/cache.go
vendored
2
internal/rpc/cache/cache.go
vendored
@ -65,7 +65,7 @@ func (s *cacheServer) Run() {
|
|||||||
defer srv.GracefulStop()
|
defer srv.GracefulStop()
|
||||||
pbCache.RegisterCacheServer(srv, s)
|
pbCache.RegisterCacheServer(srv, s)
|
||||||
|
|
||||||
rpcRegisterIP := ""
|
rpcRegisterIP := config.Config.RpcRegisterIP
|
||||||
if config.Config.RpcRegisterIP == "" {
|
if config.Config.RpcRegisterIP == "" {
|
||||||
rpcRegisterIP, err = utils.GetLocalIP()
|
rpcRegisterIP, err = utils.GetLocalIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -157,7 +157,7 @@ func (rpc *rpcConversation) Run() {
|
|||||||
|
|
||||||
//service registers with etcd
|
//service registers with etcd
|
||||||
pbConversation.RegisterConversationServer(srv, rpc)
|
pbConversation.RegisterConversationServer(srv, rpc)
|
||||||
rpcRegisterIP := ""
|
rpcRegisterIP := config.Config.RpcRegisterIP
|
||||||
if config.Config.RpcRegisterIP == "" {
|
if config.Config.RpcRegisterIP == "" {
|
||||||
rpcRegisterIP, err = utils.GetLocalIP()
|
rpcRegisterIP, err = utils.GetLocalIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -66,7 +66,7 @@ func (s *groupServer) Run() {
|
|||||||
pbGroup.RegisterGroupServer(srv, s)
|
pbGroup.RegisterGroupServer(srv, s)
|
||||||
|
|
||||||
rpcRegisterIP := config.Config.RpcRegisterIP
|
rpcRegisterIP := config.Config.RpcRegisterIP
|
||||||
if rpcRegisterIP == "" {
|
if config.Config.RpcRegisterIP == "" {
|
||||||
rpcRegisterIP, err = utils.GetLocalIP()
|
rpcRegisterIP, err = utils.GetLocalIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("", "GetLocalIP failed ", err.Error())
|
log.Error("", "GetLocalIP failed ", err.Error())
|
||||||
|
@ -63,7 +63,7 @@ func (s *messageCMSServer) Run() {
|
|||||||
defer srv.GracefulStop()
|
defer srv.GracefulStop()
|
||||||
//Service registers with etcd
|
//Service registers with etcd
|
||||||
pbMessageCMS.RegisterMessageCMSServer(srv, s)
|
pbMessageCMS.RegisterMessageCMSServer(srv, s)
|
||||||
rpcRegisterIP := ""
|
rpcRegisterIP := config.Config.RpcRegisterIP
|
||||||
if config.Config.RpcRegisterIP == "" {
|
if config.Config.RpcRegisterIP == "" {
|
||||||
rpcRegisterIP, err = utils.GetLocalIP()
|
rpcRegisterIP, err = utils.GetLocalIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -64,7 +64,7 @@ func (rpc *rpcChat) Run() {
|
|||||||
srv := grpc.NewServer()
|
srv := grpc.NewServer()
|
||||||
defer srv.GracefulStop()
|
defer srv.GracefulStop()
|
||||||
|
|
||||||
rpcRegisterIP := ""
|
rpcRegisterIP := config.Config.RpcRegisterIP
|
||||||
pbChat.RegisterChatServer(srv, rpc)
|
pbChat.RegisterChatServer(srv, rpc)
|
||||||
if config.Config.RpcRegisterIP == "" {
|
if config.Config.RpcRegisterIP == "" {
|
||||||
rpcRegisterIP, err = utils.GetLocalIP()
|
rpcRegisterIP, err = utils.GetLocalIP()
|
||||||
|
@ -71,7 +71,7 @@ func (s *officeServer) Run() {
|
|||||||
defer srv.GracefulStop()
|
defer srv.GracefulStop()
|
||||||
//Service registers with etcd
|
//Service registers with etcd
|
||||||
pbOffice.RegisterOfficeServiceServer(srv, s)
|
pbOffice.RegisterOfficeServiceServer(srv, s)
|
||||||
rpcRegisterIP := ""
|
rpcRegisterIP := config.Config.RpcRegisterIP
|
||||||
if config.Config.RpcRegisterIP == "" {
|
if config.Config.RpcRegisterIP == "" {
|
||||||
rpcRegisterIP, err = utils.GetLocalIP()
|
rpcRegisterIP, err = utils.GetLocalIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -61,7 +61,7 @@ func (s *organizationServer) Run() {
|
|||||||
defer srv.GracefulStop()
|
defer srv.GracefulStop()
|
||||||
//Service registers with etcd
|
//Service registers with etcd
|
||||||
rpc.RegisterOrganizationServer(srv, s)
|
rpc.RegisterOrganizationServer(srv, s)
|
||||||
rpcRegisterIP := ""
|
rpcRegisterIP := config.Config.RpcRegisterIP
|
||||||
if config.Config.RpcRegisterIP == "" {
|
if config.Config.RpcRegisterIP == "" {
|
||||||
rpcRegisterIP, err = utils.GetLocalIP()
|
rpcRegisterIP, err = utils.GetLocalIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -67,7 +67,7 @@ func (s *statisticsServer) Run() {
|
|||||||
defer srv.GracefulStop()
|
defer srv.GracefulStop()
|
||||||
//Service registers with etcd
|
//Service registers with etcd
|
||||||
pbStatistics.RegisterUserServer(srv, s)
|
pbStatistics.RegisterUserServer(srv, s)
|
||||||
rpcRegisterIP := ""
|
rpcRegisterIP := config.Config.RpcRegisterIP
|
||||||
if config.Config.RpcRegisterIP == "" {
|
if config.Config.RpcRegisterIP == "" {
|
||||||
rpcRegisterIP, err = utils.GetLocalIP()
|
rpcRegisterIP, err = utils.GetLocalIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -62,7 +62,7 @@ func (s *userServer) Run() {
|
|||||||
defer srv.GracefulStop()
|
defer srv.GracefulStop()
|
||||||
//Service registers with etcd
|
//Service registers with etcd
|
||||||
pbUser.RegisterUserServer(srv, s)
|
pbUser.RegisterUserServer(srv, s)
|
||||||
rpcRegisterIP := ""
|
rpcRegisterIP := config.Config.RpcRegisterIP
|
||||||
if config.Config.RpcRegisterIP == "" {
|
if config.Config.RpcRegisterIP == "" {
|
||||||
rpcRegisterIP, err = utils.GetLocalIP()
|
rpcRegisterIP, err = utils.GetLocalIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user