This commit is contained in:
aozhiwei 2020-09-19 22:13:21 +08:00
parent 0e7e7964f2
commit b796bf491d
3 changed files with 9 additions and 17 deletions

View File

@ -86,7 +86,7 @@ void IMListener::Init()
tcp_listener_->on_error = GSListeneron_error;
tcp_listener_->bind_address = "0.0.0.0";
tcp_listener_->bind_port = JsonDataMgr::Instance()->GetConf()->At("imserver_listen_port")->AsXValue();
tcp_listener_->bind_port = JsonDataMgr::Instance()->GetConf()->At("listen_port")->AsXValue();
tcp_listener_->Open();
}

View File

@ -7,17 +7,17 @@
void JsonDataMgr::Init()
{
std::string masterserver_cluster_json_file;
std::string rankserver_cluster_json_file;
if (!f8::IsOnlineEnv()) {
if (f8::IsTestEnv()) {
work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/masterserver.test",
work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/rankserver.test",
{
GAME_ID,
App::Instance()->instance_id,
GAME_ID
});
} else {
work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/masterserver.dev",
work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/rankserver.dev",
{
GAME_ID,
App::Instance()->instance_id,
@ -25,11 +25,11 @@ void JsonDataMgr::Init()
});
}
}
masterserver_cluster_json_file = a8::Format("%s/node1/game9003.masterserver.cluster.json",
rankserver_cluster_json_file = a8::Format("%s/node1/game9003.rankserver.cluster.json",
{
work_path_,
});
masterserver_cluster_json_.ReadFromFile(masterserver_cluster_json_file);
rankserver_cluster_json_.ReadFromFile(rankserver_cluster_json_file);
}
void JsonDataMgr::UnInit()
@ -38,13 +38,9 @@ void JsonDataMgr::UnInit()
std::shared_ptr<a8::XObject> JsonDataMgr::GetConf()
{
if (App::Instance()->instance_id < 1 || App::Instance()->instance_id > masterserver_cluster_json_.Size()) {
if (App::Instance()->instance_id < 1 || App::Instance()->instance_id > rankserver_cluster_json_.Size()) {
abort();
}
return masterserver_cluster_json_[App::Instance()->instance_id - 1];
return rankserver_cluster_json_[App::Instance()->instance_id - 1];
}
int JsonDataMgr::GetMasterSvrNum()
{
return masterserver_cluster_json_.Size();
}

View File

@ -11,12 +11,8 @@ class JsonDataMgr : public a8::Singleton<JsonDataMgr>
void UnInit();
std::shared_ptr<a8::XObject> GetConf();
int GetMasterSvrNum();
std::string ip;
int listen_port = 0;
private:
std::string work_path_ = "../config";
a8::XObject masterserver_cluster_json_;
a8::XObject rankserver_cluster_json_;
};