This commit is contained in:
aozhiwei 2019-05-18 16:52:58 +08:00
parent 59f9908c61
commit 0ea82a5947
5 changed files with 11 additions and 20 deletions

View File

@ -4,6 +4,8 @@ package ss;
enum SSMessageId_e enum SSMessageId_e
{ {
_SS_WSP_SocketDisconnect = 10; _SS_WSP_SocketDisconnect = 10;
_SS_WSP_RequestTargetServer = 11;
_SS_MS_ResponseTargetServer = 12;
_SS_CMPing = 101; _SS_CMPing = 101;
_SS_SMRpcError = 102; _SS_SMRpcError = 102;

View File

@ -58,6 +58,13 @@ public:
.SetParam3(saddr)); .SetParam3(saddr));
} }
virtual bool HandleRedirect(const std::string& url, const std::string& querystr,
std::string& location) override
{
location = "ws://192.168.100.21:7101";
return true;
}
virtual void OnDisConnect() override virtual void OnDisConnect() override
{ {
App::Instance()->AddIMMsg(IM_ClientSocketDisconnect, App::Instance()->AddIMMsg(IM_ClientSocketDisconnect,

View File

@ -6,28 +6,19 @@
void JsonDataMgr::Init() void JsonDataMgr::Init()
{ {
std::string wsproxyserver_cluster_json_file; std::string wsproxyserver_cluster_json_file;
#if MASTER_MODE
std::string masterserver_cluster_json_file; std::string masterserver_cluster_json_file;
#else
std::string targetserver_cluster_json_file; std::string targetserver_cluster_json_file;
#endif
if (f8::IsOnlineEnv()) { if (f8::IsOnlineEnv()) {
wsproxyserver_cluster_json_file = a8::Format("../config/game%d.wsproxy.cluster.json", {GAME_ID}); wsproxyserver_cluster_json_file = a8::Format("../config/game%d.wsproxy.cluster.json", {GAME_ID});
#if MASTER_MODE
masterserver_cluster_json_file = a8::Format("../config/game%d.masterserver.cluster.json", {GAME_ID}); masterserver_cluster_json_file = a8::Format("../config/game%d.masterserver.cluster.json", {GAME_ID});
#else
targetserver_cluster_json_file = a8::Format("../config/game%d.gameserver.cluster.json", {GAME_ID}); targetserver_cluster_json_file = a8::Format("../config/game%d.gameserver.cluster.json", {GAME_ID});
#endif
} else { } else {
wsproxyserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.wsproxy.cluster.json", wsproxyserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.wsproxy.cluster.json",
{GAME_ID, GAME_ID}); {GAME_ID, GAME_ID});
#if MASTER_MODE
masterserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.masterserver.cluster.json", masterserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.masterserver.cluster.json",
{GAME_ID, GAME_ID}); {GAME_ID, GAME_ID});
#else
targetserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.gameserver.cluster.json", targetserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.gameserver.cluster.json",
{GAME_ID, GAME_ID}); {GAME_ID, GAME_ID});
#endif
} }
wsproxyserver_cluster_json_.ReadFromFile(wsproxyserver_cluster_json_file); wsproxyserver_cluster_json_.ReadFromFile(wsproxyserver_cluster_json_file);
#if MASTER_MODE #if MASTER_MODE
@ -49,14 +40,12 @@ std::shared_ptr<a8::XObject> JsonDataMgr::GetConf()
return wsproxyserver_cluster_json_[App::Instance()->instance_id - 1]; return wsproxyserver_cluster_json_[App::Instance()->instance_id - 1];
} }
#if MASTER_MODE
std::shared_ptr<a8::XObject> JsonDataMgr::GetMasterServerClusterConf() std::shared_ptr<a8::XObject> JsonDataMgr::GetMasterServerClusterConf()
{ {
return std::make_shared<a8::XObject>(masterserver_cluster_json_); return std::make_shared<a8::XObject>(masterserver_cluster_json_);
} }
#else
std::shared_ptr<a8::XObject> JsonDataMgr::GetTargetServerClusterConf() std::shared_ptr<a8::XObject> JsonDataMgr::GetTargetServerClusterConf()
{ {
return std::make_shared<a8::XObject>(targetserver_cluster_json_); return std::make_shared<a8::XObject>(targetserver_cluster_json_);
} }
#endif

View File

@ -11,19 +11,12 @@ class JsonDataMgr : public a8::Singleton<JsonDataMgr>
void UnInit(); void UnInit();
std::shared_ptr<a8::XObject> GetConf(); std::shared_ptr<a8::XObject> GetConf();
#if MASTER_MODE
std::shared_ptr<a8::XObject> GetMasterServerClusterConf(); std::shared_ptr<a8::XObject> GetMasterServerClusterConf();
#else
std::shared_ptr<a8::XObject> GetTargetServerClusterConf(); std::shared_ptr<a8::XObject> GetTargetServerClusterConf();
#endif
private: private:
a8::XObject wsproxyserver_cluster_json_; a8::XObject wsproxyserver_cluster_json_;
#if MASTER_MODE
a8::XObject masterserver_cluster_json_; a8::XObject masterserver_cluster_json_;
#else
a8::XObject targetserver_cluster_json_; a8::XObject targetserver_cluster_json_;
#endif
}; };

@ -1 +1 @@
Subproject commit fc99a3615db9aabc1a77489e069a4e6af26d50d5 Subproject commit ff8c00652d5367595c4adee8f95306ae1a46236b