This commit is contained in:
aozhiwei 2020-08-22 21:24:35 +08:00
parent a037b22de9
commit da3c6ee96e
5 changed files with 22 additions and 26 deletions

View File

@ -1,13 +0,0 @@
#pragma once
/*
http的错误码设计
0
<400:
>500:
*/
enum ErrorCode_e
{
ERRNO_OK = 0,
};

View File

@ -26,18 +26,8 @@ void GSMgr::UnInit()
void GSMgr::_SS_WSP_RequestTargetServer(f8::MsgHdr& hdr, const ss::SS_WSP_RequestTargetServer& msg) void GSMgr::_SS_WSP_RequestTargetServer(f8::MsgHdr& hdr, const ss::SS_WSP_RequestTargetServer& msg)
{ {
int channel = f8::ExtractChannelIdFromAccountId(msg.account_id()); int channel = GetTargetChannel(msg);
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
ss::SS_MS_ResponseTargetServer respmsg; ss::SS_MS_ResponseTargetServer respmsg;
respmsg.set_context_id(msg.context_id()); respmsg.set_context_id(msg.context_id());
if (msg.is_reconnect()) { if (msg.is_reconnect()) {
@ -314,3 +304,20 @@ void GSMgr::OnChannelChange(GSNode* node)
RemoveNodeFromSortedNodes(node); RemoveNodeFromSortedNodes(node);
AddNodeToSortedNodes(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;
}

View File

@ -48,6 +48,7 @@ class GSMgr : public a8::Singleton<GSMgr>
void RemoveNodeFromSortedNodes(GSNode* node); void RemoveNodeFromSortedNodes(GSNode* node);
std::vector<GSNode*>* GetSortedNodesByChannel(int channel); std::vector<GSNode*>* GetSortedNodesByChannel(int channel);
void OnChannelChange(GSNode* node); void OnChannelChange(GSNode* node);
int GetTargetChannel(const ss::SS_WSP_RequestTargetServer& msg);
private: private:

View File

@ -5,7 +5,6 @@
#include "constant.h" #include "constant.h"
#include "types.h" #include "types.h"
#include "error_code.h"
#include "global.h" #include "global.h"
namespace google namespace google

View File

@ -22,6 +22,8 @@ message SS_WSP_RequestTargetServer
optional string server_info = 4; optional string server_info = 4;
optional int32 is_reconnect = 5; optional int32 is_reconnect = 5;
optional int32 proto_version = 6; //Constant_e.ProtoVersion optional int32 proto_version = 6; //Constant_e.ProtoVersion
optional string url = 7;
optional string query_str = 8;
} }
message SS_MS_ResponseTargetServer message SS_MS_ResponseTargetServer