From da3c6ee96e483e53c65f6175a4acf3564afc71b7 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 22 Aug 2020 21:24:35 +0800 Subject: [PATCH] 1 --- server/masterserver/error_code.h | 13 ----------- server/masterserver/gsmgr.cc | 31 ++++++++++++++++---------- server/masterserver/gsmgr.h | 1 + server/masterserver/precompile.h | 1 - server/tools/protobuild/ss_proto.proto | 2 ++ 5 files changed, 22 insertions(+), 26 deletions(-) delete mode 100755 server/masterserver/error_code.h diff --git a/server/masterserver/error_code.h b/server/masterserver/error_code.h deleted file mode 100755 index 35ec63e..0000000 --- a/server/masterserver/error_code.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -/* - 类似http的错误码设计 - 0:成功 - <400: 客户端的错 - >500: 服务器的错 -*/ -enum ErrorCode_e -{ - ERRNO_OK = 0, - -}; diff --git a/server/masterserver/gsmgr.cc b/server/masterserver/gsmgr.cc index 68fd153..2ca0a44 100644 --- a/server/masterserver/gsmgr.cc +++ b/server/masterserver/gsmgr.cc @@ -26,18 +26,8 @@ void GSMgr::UnInit() void GSMgr::_SS_WSP_RequestTargetServer(f8::MsgHdr& hdr, const ss::SS_WSP_RequestTargetServer& msg) { - int channel = f8::ExtractChannelIdFromAccountId(msg.account_id()); - if (!App::Instance()->IsSeparateChannel(channel)) { - channel = 0; - } - #if 1 - int src_channel = f8::ExtractChannelIdFromAccountId(msg.account_id()); - if (channel == 0 && - src_channel == kTouTiaoChannelId && - msg.proto_version() == 2019071502) { - channel = src_channel; - } - #endif + int channel = GetTargetChannel(msg); + ss::SS_MS_ResponseTargetServer respmsg; respmsg.set_context_id(msg.context_id()); if (msg.is_reconnect()) { @@ -314,3 +304,20 @@ void GSMgr::OnChannelChange(GSNode* node) RemoveNodeFromSortedNodes(node); AddNodeToSortedNodes(node); } + +int GSMgr::GetTargetChannel(const ss::SS_WSP_RequestTargetServer& msg) +{ + int channel = f8::ExtractChannelIdFromAccountId(msg.account_id()); + if (!App::Instance()->IsSeparateChannel(channel)) { + channel = 0; + } + #if 1 + int src_channel = f8::ExtractChannelIdFromAccountId(msg.account_id()); + if (channel == 0 && + src_channel == kTouTiaoChannelId && + msg.proto_version() == 2019071502) { + channel = src_channel; + } + #endif + return channel; +} diff --git a/server/masterserver/gsmgr.h b/server/masterserver/gsmgr.h index 4232080..9c8c3ee 100644 --- a/server/masterserver/gsmgr.h +++ b/server/masterserver/gsmgr.h @@ -48,6 +48,7 @@ class GSMgr : public a8::Singleton void RemoveNodeFromSortedNodes(GSNode* node); std::vector* GetSortedNodesByChannel(int channel); void OnChannelChange(GSNode* node); + int GetTargetChannel(const ss::SS_WSP_RequestTargetServer& msg); private: diff --git a/server/masterserver/precompile.h b/server/masterserver/precompile.h index 49c2658..50e6f1d 100644 --- a/server/masterserver/precompile.h +++ b/server/masterserver/precompile.h @@ -5,7 +5,6 @@ #include "constant.h" #include "types.h" -#include "error_code.h" #include "global.h" namespace google diff --git a/server/tools/protobuild/ss_proto.proto b/server/tools/protobuild/ss_proto.proto index ab225c3..62359ba 100755 --- a/server/tools/protobuild/ss_proto.proto +++ b/server/tools/protobuild/ss_proto.proto @@ -22,6 +22,8 @@ message SS_WSP_RequestTargetServer optional string server_info = 4; optional int32 is_reconnect = 5; optional int32 proto_version = 6; //协议版本号Constant_e.ProtoVersion + optional string url = 7; + optional string query_str = 8; } message SS_MS_ResponseTargetServer