From 12e6f6d7fbf295d7504e297eed3ad5574cc1a1d3 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 16 Jun 2020 15:18:30 +0800 Subject: [PATCH] 1 --- server/masterserver/svrmgr.cc | 16 +++++++++++++++- server/tools/protobuild/ss_proto.proto | 18 ++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/server/masterserver/svrmgr.cc b/server/masterserver/svrmgr.cc index fc00002..7f3646d 100644 --- a/server/masterserver/svrmgr.cc +++ b/server/masterserver/svrmgr.cc @@ -106,7 +106,21 @@ void SvrMgr::_SS_IM_ReportServerInfo(f8::MsgHdr& hdr, const ss::SS_IM_ReportServ void SvrMgr::_SS_IM_IMServerList(f8::MsgHdr& hdr, const ss::SS_IM_IMServerList& msg) { - + SvrNode* node = GetNodeBySocket(hdr.socket_handle); + if (node) { + ss::SS_MS_IMServerList respmsg; + for (auto& pair : node_key_hash_) { + if (node != pair.second) { + auto p = respmsg.add_server_list(); + p->set_instance_id(pair.second->instance_id); + p->set_online_num(pair.second->online_num); + p->set_ip(pair.second->ip); + p->set_port(pair.second->port); + p->set_servicing(pair.second->servicing); + } + } + IMListener::Instance()->SendMsg(hdr.socket_handle, respmsg); + } } void SvrMgr::___GSList(f8::JsonHttpRequest* request) diff --git a/server/tools/protobuild/ss_proto.proto b/server/tools/protobuild/ss_proto.proto index d9ae877..a9d8a4e 100755 --- a/server/tools/protobuild/ss_proto.proto +++ b/server/tools/protobuild/ss_proto.proto @@ -17,6 +17,15 @@ message MFIMMsgConext optional int64 base_data_version = 100; //数据版本号 } +message MFIMServerInfo +{ + optional int32 instance_id = 1; + optional int32 online_num = 2; + optional string ip = 3; + optional int32 port = 4; + optional bool servicing = 5; +} + message MFBaseUserDataDB { optional string account_id = 1; //账号id @@ -149,21 +158,21 @@ message SS_MS_ConfirmedServerInfo message SS_IM_UserOnline { - optional string account_id = 1; + repeated cs.MFUserInfo user_infos = 1; } message SS_IM_UserOffline { - optional string account_id = 1; + repeated string account_ids = 1; } message SS_IM_PullUserList { - + repeated string account_ids = 1; } message SS_MS_PushUserList { - + repeated cs.MFUserInfo user_infos = 1; } message SS_IM_SendChatMsg @@ -189,6 +198,7 @@ message SS_IM_IMServerList } message SS_MS_IMServerList { + repeated MFIMServerInfo server_list = 1; } message SS_IM_UpdateUserInfo