1
This commit is contained in:
parent
415f509878
commit
0ec8f9133b
@ -18,16 +18,16 @@ void JsonDataMgr::Init()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string wsproxyserver_cluster_json_file;
|
std::string wsproxy_cluster_json_file;
|
||||||
std::string masterserver_cluster_json_file;
|
std::string master_cluster_json_file;
|
||||||
wsproxyserver_cluster_json_file = a8::Format
|
wsproxy_cluster_json_file = a8::Format
|
||||||
("%s/node%d/game%d.wsproxy.cluster.json",
|
("%s/node%d/game%d.wsproxy.cluster.json",
|
||||||
{
|
{
|
||||||
work_path_,
|
work_path_,
|
||||||
App::Instance()->GetNodeId(),
|
App::Instance()->GetNodeId(),
|
||||||
GAME_ID
|
GAME_ID
|
||||||
});
|
});
|
||||||
masterserver_cluster_json_file = a8::Format
|
master_cluster_json_file = a8::Format
|
||||||
("%s/node%d/game%d.masterserver.cluster.json",
|
("%s/node%d/game%d.masterserver.cluster.json",
|
||||||
{
|
{
|
||||||
work_path_,
|
work_path_,
|
||||||
@ -35,8 +35,8 @@ void JsonDataMgr::Init()
|
|||||||
GAME_ID
|
GAME_ID
|
||||||
});
|
});
|
||||||
|
|
||||||
wsproxyserver_cluster_json_.ReadFromFile(wsproxyserver_cluster_json_file);
|
wsproxy_cluster_json_.ReadFromFile(wsproxy_cluster_json_file);
|
||||||
masterserver_cluster_json_.ReadFromFile(masterserver_cluster_json_file);
|
master_cluster_json_.ReadFromFile(master_cluster_json_file);
|
||||||
udp_host_ = GetConf()->At("listen_udp_host")->AsXValue().GetString();
|
udp_host_ = GetConf()->At("listen_udp_host")->AsXValue().GetString();
|
||||||
udp_port_ = GetConf()->At("listen_udp_port")->AsXValue();
|
udp_port_ = GetConf()->At("listen_udp_port")->AsXValue();
|
||||||
}
|
}
|
||||||
@ -47,8 +47,8 @@ void JsonDataMgr::UnInit()
|
|||||||
|
|
||||||
std::shared_ptr<a8::XObject> JsonDataMgr::GetConf()
|
std::shared_ptr<a8::XObject> JsonDataMgr::GetConf()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < wsproxyserver_cluster_json_.Size(); ++i) {
|
for (int i = 0; i < wsproxy_cluster_json_.Size(); ++i) {
|
||||||
std::shared_ptr<a8::XObject> conf = wsproxyserver_cluster_json_.At(i);
|
std::shared_ptr<a8::XObject> conf = wsproxy_cluster_json_.At(i);
|
||||||
if (conf->At("instance_id")->AsXValue().GetInt() == App::Instance()->GetInstanceId()) {
|
if (conf->At("instance_id")->AsXValue().GetInt() == App::Instance()->GetInstanceId()) {
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
@ -58,8 +58,8 @@ std::shared_ptr<a8::XObject> JsonDataMgr::GetConf()
|
|||||||
|
|
||||||
void JsonDataMgr::TraverseMaster(std::function<void (int, std::string, int)> cb)
|
void JsonDataMgr::TraverseMaster(std::function<void (int, std::string, int)> cb)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < masterserver_cluster_json_.Size(); ++i) {
|
for (int i = 0; i < master_cluster_json_.Size(); ++i) {
|
||||||
auto master_svr_conf = masterserver_cluster_json_.At(i);
|
auto master_svr_conf = master_cluster_json_.At(i);
|
||||||
int instance_id = master_svr_conf->At("instance_id")->AsXValue();
|
int instance_id = master_svr_conf->At("instance_id")->AsXValue();
|
||||||
std::string remote_ip = master_svr_conf->At("ip")->AsXValue();
|
std::string remote_ip = master_svr_conf->At("ip")->AsXValue();
|
||||||
int remote_port = master_svr_conf->At("port")->AsXValue();
|
int remote_port = master_svr_conf->At("port")->AsXValue();
|
||||||
|
@ -19,8 +19,8 @@ class JsonDataMgr : public a8::Singleton<JsonDataMgr>
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::string work_path_ = "../config";
|
std::string work_path_ = "../config";
|
||||||
a8::XObject wsproxyserver_cluster_json_;
|
a8::XObject wsproxy_cluster_json_;
|
||||||
a8::XObject masterserver_cluster_json_;
|
a8::XObject master_cluster_json_;
|
||||||
std::string udp_host_;
|
std::string udp_host_;
|
||||||
int udp_port_ = 0;
|
int udp_port_ = 0;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user